|
-
Aug 5th, 2000, 07:47 PM
#1
Thread Starter
Hyperactive Member
After a lot of help from this group and others I have successfully learned how to connect to an access database, write, update, and delete records. Thanks. But I still have questions. Please help below if you can.
1. I need to be able to search the records for a few different options and obviously display the results. The way I have it setup is a drop down box populated with 3 options for search criteria. I also have a text box which is where the user will input what they want to search for. Please help with the code necessary for this to work. Thank you.
Code:
<select name="search">
<option value="PhoneNumber">Phone Number"</option>
<option value="CustomerLastName">Customer's Last Name</option>
<opiton value="TicketNumber">Ticket Number</option>
</select>
...
<input type="text" name="criteria">
2. I also have been using checkboxes on one of my pages, but when I try to edit the entries the checkboxes always show empty.
Code:
<input type="checkbox" name="error" value="629">Error 629<br>
<input type="checkbox" name="error" value="691">Error 691<br>
Thank you for any help
If you think education is expensive, try ignorance.
-
Aug 6th, 2000, 01:25 PM
#2
Monday Morning Lunatic
Use a value of 1 or 0 for the checkbox.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 6th, 2000, 03:11 PM
#3
Thread Starter
Hyperactive Member
Like this?
You mean like this?
Code:
<input type="checkbox" name="error" value="1">Error 629<br>
<input type="checkbox" name="error" value="0">Error 691<br>
I don't see how changing to this will change anything, so please help me with more information if you can. thank you.
If you think education is expensive, try ignorance.
-
Aug 6th, 2000, 03:56 PM
#4
Monday Morning Lunatic
I think I'm getting confused here . Do you need to show a checkbox as checked on the form?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 6th, 2000, 04:53 PM
#5
Thread Starter
Hyperactive Member
Sort of. When someone is filling out the form for the first time it's obviously going to be unchecked. But if they need to update a previously enterred record it should come up as it was enterred the first time. I would use...
Code:
<input type="text" name="RepName" value="<%= rst("RepName")%>">
if it was a text box and it would then get the information from the database to populate the box. I don't know how to use checkboxes like this because the value is already used in the checkbox code.
Sorry if I can't explain it very well. I'm trying.
If you think education is expensive, try ignorance.
-
Aug 7th, 2000, 03:02 AM
#6
Monday Morning Lunatic
Aha. Got it. Right - in your DB, if you have a Boolean value, then use that whether or not to insert a 'checked' into the tag:
<input type=checkbox name=chkMyBox checked>
Miss out the checked for an unselected box.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 7th, 2000, 04:12 AM
#7
Yeah, the value argument of the checkbox is what is returned to the server when the page is processed. I don't think setting this at design time (in the HTML code makes any difference). Each checkbox returns 1, 0, true or false when the form is submitted. 
I think each checkbox should have a different name too. You seem to be using checkboxes like option buttons. They're not the same. A group of option buttons all have the same name but different values. The value of the one the user clicked is what is returned to the server, and (as parksie points out) you set which one is selected at startup with the checked argument.
Check boxes work independently of each other. They must all have different names and each one sends a true or false value to the server depending on its state when you submit the form.
[Edited by matthewralston on 08-07-2000 at 05:17 AM]
-
Aug 7th, 2000, 10:05 AM
#8
Thread Starter
Hyperactive Member
Thank you both. You are exactly right and that's where I'm getting lost. I am using it as a radio button. I now know the fix. thanks again.
If you think education is expensive, try ignorance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|