Link to home
Start Free TrialLog in
Avatar of LelloLello
LelloLello

asked on

is there a way i can show in my form that a checkbox is checked according to the entry in my sql table field.

Please see attached image before you read my question.

There is a SQL Database has this type of field.
Column Name: CMTEE_PREF and the Data Type varchar 25

I did a Coldfusion query and i'm able to retreive data in that data field. Data was
POL,SOP,EE,TF

Now I have a form with 4 checkbox, one for POL, SOP, EE, and TF.

Is there a way, that a checkbox can be clicked if the pol, sop, ee or TF was entered in the table. I would like to show that the checkbox is clicked if POL, SOP, or EE, or TF was in my CMTEE_PREF field ? Any way i can do that ?

This is my form code:

.......
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">&nbsp;<label>Policy setting committees (POL)</label><br>

<input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF2" value="SOP">&nbsp;<label>Standard of practice setting committees (SOP)</label><br>

<input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF3" value="EEP">&nbsp;<label>Committees related to education and eligibility issues <em>(EE)</em></label><br>

<input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF4" value="ADMIN">&nbsp;<label>Administrative committees such as Finance or Elections <em>(ADMIN)</em></label><br>

<input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF5" value="TF">&nbsp;<label>Task Forces (typically short term commitment) <em>(TF)</em></label><br>

<input type="checkbox" name="CMTEE_PREF" id="CMTEE_PREF6" value="ANY">&nbsp;<label>Doesn’t matter, I just want to volunteer. <em>(ANY)</em></label>
SQL-Table.jpg
CMTEE-PREF.jpg
Avatar of Rajeev
Rajeev
Flag of India image

Hi,
I am not sure about JAVA, but in most of the languages, you can "split" the string in an array with a delimeter and then run the LOOP to check what all you need to mark "Checked".

If you want that your SQL Data should come in any different format (which helps you to mark check) then let us know the format.
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LelloLello
LelloLello

ASKER

Excellent... Do you know i've still have a problem with a question it's a radio button... if i don't select yes or no i'm getting an error i wil post this new question please advice.
Super!