universal sea
11-03-2005, 05:52 PM
I am working on a dating site for a client. While I am a senior PHP/MySQL programmer, Javascript has consistently evaded my learnings. Hours of searching for this today has resulted in not much. I appreciate your assistance.
Basically what I'm trying to do is this:
- There are numerous rows of different checkbox search fields, such as Languages, Hobbies and Occupation.
- Each of these fields has a "Doesn't matter" checkbox, which is the default and is checked at start up
- If one of the other checkboxes is clicked, the client wants the Doesn't matter checkbox to be unclicked
- If the Doesn't matter box is checked again, all the other boxes should be deselected.
One complication is that the form fields are generated automatically by a universal PHP script that generates all form fields, adding to search strings, the tables they are posted into, etc. Things like providing a separate fieldname for the Default checkbox item might not be easily possible. If there are ways I can maintain the same fieldname for each category while accomplishing this, that would be ideal.
note the naming conventions of these example fields:
<!-- RELATIONSHIP-->
<input type=checkbox name=relationship[] value="50" class=small> Single - never married
<input type=checkbox name=relationship[] value="52" class=small> Separated
<input type=checkbox name=relationship[] value="51" class=small> Divorced
<input type=checkbox name=relationship[] value="53" class=small> Widowed
<input type=checkbox name=relationship[] value="109" class=small> Attached
<input type=checkbox name=relationship[] value="54" class=small> Married
<input type=checkbox name=relationship[] value="xx" checked class=small> Doesn't matter
<!-- HAVE CHILDREN?
// searches for any of the options checked
-->
<input type=checkbox name=children[] value="5" class=small> None
<input type=checkbox name=children[] value="55" class=small> Yes - living with me full-time
<input type=checkbox name=children[] value="56" class=small> Yes - living with me part-time
<input type=checkbox name=children[] value="57" class=small> Yes - not living with me
<input type=checkbox name=children[] value="xx" checked class=small> Doesn't matter
Cheers.
Basically what I'm trying to do is this:
- There are numerous rows of different checkbox search fields, such as Languages, Hobbies and Occupation.
- Each of these fields has a "Doesn't matter" checkbox, which is the default and is checked at start up
- If one of the other checkboxes is clicked, the client wants the Doesn't matter checkbox to be unclicked
- If the Doesn't matter box is checked again, all the other boxes should be deselected.
One complication is that the form fields are generated automatically by a universal PHP script that generates all form fields, adding to search strings, the tables they are posted into, etc. Things like providing a separate fieldname for the Default checkbox item might not be easily possible. If there are ways I can maintain the same fieldname for each category while accomplishing this, that would be ideal.
note the naming conventions of these example fields:
<!-- RELATIONSHIP-->
<input type=checkbox name=relationship[] value="50" class=small> Single - never married
<input type=checkbox name=relationship[] value="52" class=small> Separated
<input type=checkbox name=relationship[] value="51" class=small> Divorced
<input type=checkbox name=relationship[] value="53" class=small> Widowed
<input type=checkbox name=relationship[] value="109" class=small> Attached
<input type=checkbox name=relationship[] value="54" class=small> Married
<input type=checkbox name=relationship[] value="xx" checked class=small> Doesn't matter
<!-- HAVE CHILDREN?
// searches for any of the options checked
-->
<input type=checkbox name=children[] value="5" class=small> None
<input type=checkbox name=children[] value="55" class=small> Yes - living with me full-time
<input type=checkbox name=children[] value="56" class=small> Yes - living with me part-time
<input type=checkbox name=children[] value="57" class=small> Yes - not living with me
<input type=checkbox name=children[] value="xx" checked class=small> Doesn't matter
Cheers.