I have a linkfield called LOCATION. Checkboxes are used to give this field multiple values, such as TOP, DOWN, UP, BOTTOM. These are stored in the database as , TOP, UP, and such.
Is it possible to search for both values? Something like this?
I tried all variations of the condition: and, or, like. I also tried all variations for the 'locationcondition' as well. Nothing.
I either get no result, or both results even though I searched only one of them, or only the result for one of them even though I searched for both. The most interesting thing, is that the ALLVARS and the debug info confirm that only the later checkbox's value is actually submitted. So even if I selected both TOP and BOTTOM, only BOTTOM would be searched for.
Anybody has an advanced search page that has multiple values for a single field?
May I propose a solution. Not a pretty one... Technically, if you have a field that is populated from checkboxes, the DB field will have something like , firstvalue, secondvalue.
So when trying to search for both of them through a search form that has these values presented as checkboxes, you will be really searching for the , secondvalue (since it uses only the last checkbox value for the search).
BUT, if I was to create a text input field, instead of the checkboxes, and enter this: , firstvalue , secondvalue into the text field, and make sure that the searchcondition on these is 'or', then it would find the links that have EITHER values.
Since I am no programmer, I just began searching for ready to use Javascripts to the following: - grab the values of checkboxes and populate the value of a hidden text field - make sure that de-checking a checkbox deletes that entry from the value of the hidden text field - make sure there is a space between the values
That's it. This way, you could search for all of those values.
Can you or anybody write such a javascript? I know I can't, and I can't seem to find one. All I know, is that whoever knows Javascript, this shouldn't take longer than a few hours to implement.
Granted, this isn't a good solution, since people could have Javascript turned off.... But I doubt there are many of those out there in this day of age.
Comments on search for multiple values
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
I have a linkfield called LOCATION. Checkboxes are used to give this field multiple values, such as TOP, DOWN, UP, BOTTOM. These are stored in the database as , TOP, UP, and such.
Is it possible to search for both values? Something like this?
I tried all variations of the condition: and, or, like. I also tried all variations for the 'locationcondition' as well. Nothing.
I either get no result, or both results even though I searched only one of them, or only the result for one of them even though I searched for both. The most interesting thing, is that the ALLVARS and the debug info confirm that only the later checkbox's value is actually submitted. So even if I selected both TOP and BOTTOM, only BOTTOM would be searched for.
Anybody has an advanced search page that has multiple values for a single field?
Thanks
David
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
It's not possible to search the same field twice in a form.
Forum Regular
Usergroup: Customer
Joined: Jun 22, 2005
Total Topics: 91
Total Comments: 305
Hi Paul,
Will this be in v5?
May I propose a solution. Not a pretty one...
Technically, if you have a field that is populated from checkboxes, the DB field will have something like , firstvalue, secondvalue.
So when trying to search for both of them through a search form that has these values presented as checkboxes, you will be really searching for the , secondvalue (since it uses only the last checkbox value for the search).
BUT, if I was to create a text input field, instead of the checkboxes, and enter this:
, firstvalue , secondvalue
into the text field, and make sure that the searchcondition on these is 'or', then it would find the links that have EITHER values.
Since I am no programmer, I just began searching for ready to use Javascripts to the following:
- grab the values of checkboxes and populate the value of a hidden text field
- make sure that de-checking a checkbox deletes that entry from the value of the hidden text field
- make sure there is a space between the values
That's it. This way, you could search for all of those values.
Can you or anybody write such a javascript? I know I can't, and I can't seem to find one. All I know, is that whoever knows Javascript, this shouldn't take longer than a few hours to implement.
Granted, this isn't a good solution, since people could have Javascript turned off.... But I doubt there are many of those out there in this day of age.
So what do you think?
Thanks
David
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
No, it's not in version 5. Estimate to add it to v5 as a custom project (in PHP, since my javascript knowledge is pathetic) is 1-3 hours ($50-$150).
name="locationcondition[]" will be necessary to send an array that can be processed.