Chris__T
Posts: 339
|
Posted: 05/09/2008, 2:12 PM |
|
I've got a search box, with one textbox that it searches on.
I would like to put several checkboxes in this searchbox, with names next to each one. then the user checks the box of the name they would like to search on.
The question is: how do I transfer their checkbox decisions over to the textbox that does the search criteria?
I thought of doing if-then statements when the search button is clicked, but that just stuck "checkbox1=1" into the URL where the search data would go.
I had in my if-then statements: if form.checkbox1.value =1 then form.textbox1.value = "Smith"
if form.checkbox2.value=1 then form.textbox1.value = form.textbox1.value & " White"
that doesn't work. I'm wondering if I'm going about this the wrong way
|
|
|
Edd
Posts: 547
|
Posted: 05/10/2008, 7:18 AM |
|
Checkboxes are not recommeded as an unchecked field is never passed, look at the argument string.
I suggest changing them to radio buttons.
Edd
_________________
Accepting and instigating change are life's challenges.
http://www.syntech.com.au |
|
|
wkempees
Posts: 1679
|
Posted: 05/10/2008, 4:39 PM |
|
Not entirely sure but:
if form.checkbox1.value =1 then form.textbox1.value = form.checkbox1.text End If
form.checkbox1.value =1/true depends on your settings both in Project Setting as well as in the ChekBox porperties
If it is a CheckBox List (multi checkbox) then there is a different syntax to read which are checked.
snippet
Dim a_temp 'a_ for array
a_temp = CCGetFromPost("s_checkboxlist", "")
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
Chris__T
Posts: 339
|
Posted: 05/12/2008, 6:48 AM |
|
With radio buttons, you can only pick one choice. I would like to pick from several choices.
With the checkbox list, does it read which ones are checked, and pass the data associated with it (a field from your chosen db table) and pass that to the search?
Walter, this is related to the issue we were discussing before: searching on multiple keywords. I'm trying to simplify it for the user by having them check off next to each name that they want to search on. So I was thinking: Click on all the checkboxes next to the name they want to search on. Then transfer these names to the search textbox that does the search on multiple keywords, then it feeds that to the grid.
|
|
|
Chris__T
Posts: 339
|
Posted: 05/12/2008, 9:12 AM |
|
Actually it might be easier to add text to the search textbox (s_LName) by doing the checkboxes via Javascript. Have all the checkboxes with values of the lastname (checkbox1.value = "Jones", etc..) and then have a button onclick that if document.form1.checkbox1.checked == true, then document.form.s_LName.value += checkbox1.value;
It should work. But it doesn't. Does it matter if you use html checkboxes or form checkboxes?
|
|
|
Chris__T
Posts: 339
|
Posted: 05/12/2008, 10:25 AM |
|
I used javascript to solve this problem. Basically if/then statements checking the checked value of the box, then if checked, putting the value into the search textbox. Thanks for you help, Edd and Walter
|
|
|
wkempees
Posts: 1679
|
Posted: 05/12/2008, 10:26 AM |
|
Use Form->Checkbox List
Default it will return only first checked checkbox.
You can however retreive multiple checked same way as in multi select listbox
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
|
|
Chris__T
Posts: 339
|
Posted: 05/12/2008, 11:41 AM |
|
interesting. Let me check that out.
|
|
|
Chris__T
Posts: 339
|
Posted: 05/12/2008, 12:04 PM |
|
Actually the multi select listbox works better than the checkboxes. I set it to when the user double clicks the name in the listbox, it moves the selected name to the search textbox. Actually that's just a regular listbox, not a multiple
So thanks for bringing that idea up Walter. The listbox can take up less space than the checkboxes too.
|
|
|
wkempees
|
Posted: 05/13/2008, 4:08 AM |
|
happy you are happy
Walter
"Chris__T" <Chris__T@forum.codecharge> schreef in bericht
news:6482894b2a6b10@news.codecharge.com...
> Actually the multi select listbox works better than the checkboxes. I set
> it to
> when the user double clicks the name in the listbox, it moves the selected
> name
> to the search textbox. Actually that's just a regular listbox, not a
> multiple
>
>
> So thanks for bringing that idea up Walter. The listbox can take up less
> space
> than the checkboxes too.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|