koila
asked on
How do you display a Checked button.
I have the field CMTEE_PREF_NEW
Varchar(50)
it has this information (POL,SOP,EE,ADMIN,TF,ANY)
My question has 6 checkbox. How I can make the checkbox checked when the user load that forms to update his profile...
This is my coldfusion cfouput
<cfoutput>#DisplayCVIToolv olunteer.C MTEE_PREF_ NEW#</cfou tput>
I will get this information: POL,SOP,EE,ADMIN,TF,ANY
How I can checked into the forms? when the user load the forms...
[x] Policy setting committees (POL)
[x] Standard of practice setting committees (SOP)
[x] Committees related to education and eligibility issues (EE)
....
this is my code.
reading-yes.jpg
display-data.jpg
Varchar(50)
it has this information (POL,SOP,EE,ADMIN,TF,ANY)
My question has 6 checkbox. How I can make the checkbox checked when the user load that forms to update his profile...
This is my coldfusion cfouput
<cfoutput>#DisplayCVIToolv
I will get this information: POL,SOP,EE,ADMIN,TF,ANY
How I can checked into the forms? when the user load the forms...
[x] Policy setting committees (POL)
[x] Standard of practice setting committees (SOP)
[x] Committees related to education and eligibility issues (EE)
....
this is my code.
<p><br>
<label for="strEmail"><strong><strong>2.</strong> We have categorized the various committees. Which of the following types of committee would you prefer to serve on?</label>
</p>
<table border="0" cellspacing="0" cellpadding="0" width="100%" class="qtable">
<tr>
<td colspan="2" height="5" width="100%"><!--- This is your database results: <cfoutput><input type="text" name="CMTEE_PREF" value="#DisplayCVITool.CMTEE_PREF#" style="width: 200px;background:red;"></cfoutput><br>--->
<!--- <input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF1" value="POL"> <label>Policy setting committees (POL)</label>--->
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF1"
value="POL"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "POL")>checked</cfif>>
<label>Policy setting committees (POL)</label>
<br>
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF2"
value="SOP"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "SOP")>checked</cfif>>
<label>Standard of practice setting committees (SOP)</label>
<br>
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF3"
value="EE"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "EE")>checked</cfif>>
<label>
Committees related to education and eligibility issues <em>(EE)</em></
label><br>
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF4"
value="ADMIN"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "ADMIN")>checked</cfif>>
<label>Administrative committees such as Finance or Elections <em>(ADMIN)</em></label>
<br>
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF5"
value="TF"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "TF")>checked</cfif>>
<label>Task Forces (typically short term commitment) <em>(TF)</em></label>
<br>
<input type="checkbox" name="CMTEE_PREF_NEW" id="CMTEE_PREF6"
value="ANY"
<cfif listFindNoCase(DisplayCVITool.CMTEE_PREF, "ANY")>checked</cfif>>
<label>Doesn’t matter, I just want to volunteer. <em>(ANY)</em></label></td>
</tr>
</table>
SQL-Table-data.jpgreading-yes.jpg
display-data.jpg
ASKER
Hello Agx,
So your recomandation is to have a field YES NO for POL
and YES No for SOP ?
thank you,
So your recomandation is to have a field YES NO for POL
and YES No for SOP ?
thank you,
(Edit) No, I usually create a separate table for storing many-to-many relationships. Have a separate table for distinct volunteers and categories. Then store each volunteer + category in a 3rd table, as a separate record.
Volunteer Unique volunteer records ..
Columns: VolunteerID (PK), FirstName, LastName, .....
Category: Distinct categories POL, SOP, EE, etc...
Columns: CategoryID (PK), CategoryTitle, CategoryCode (POL, SOP, EE, etc...)
VolunteerCategory: One record for each volunteer + category
Columns: VolunteerID, CategoryID
Example:
VolunteerID | CategoryID
22 | 3 <=== ie Volunteer AA + POL
22 | 5 <=== ie Volunteer AA + EE
22 | 1 <=== ie Volunteer AA + SOP
12 | 3 <=== ie Volunteer BB+ POL
Volunteer Unique volunteer records ..
Columns: VolunteerID (PK), FirstName, LastName, .....
Category: Distinct categories POL, SOP, EE, etc...
Columns: CategoryID (PK), CategoryTitle, CategoryCode (POL, SOP, EE, etc...)
VolunteerCategory: One record for each volunteer + category
Columns: VolunteerID, CategoryID
Example:
VolunteerID | CategoryID
22 | 3 <=== ie Volunteer AA + POL
22 | 5 <=== ie Volunteer AA + EE
22 | 1 <=== ie Volunteer AA + SOP
12 | 3 <=== ie Volunteer BB+ POL
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you please help me with my other questions.
That said, while I can't test it now - your code should work. Unless maybe your list contains different values or extra spaces? Lists are extremely sensitive to *any* differences, including spaces, which is one of the reasons to avoid them ...
Test case:
<cfset DisplayCVITool.CMTEE_PREF = "POL,SOP,EE">
<form>
POL <input type="checkbox" name="CMTEE_PREF_NEW" value="POL"
<cfif listFindNoCase(DisplayCVIT
SOP <input type="checkbox" name="CMTEE_PREF_NEW" value="SOP"
<cfif listFindNoCase(DisplayCVIT
EE <input type="checkbox" name="CMTEE_PREF_NEW" value="EE"
<cfif listFindNoCase(DisplayCVIT
</form>