• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

Getting checked or unchecked checkboxes on update page from checkbox-group

Hallo experts.
How can i get checked or uncheched my checkboxes in a update page getting the values from a column where i have values inserted with a checkbox group.
Using:
<input <cfif (#dboartikel.Metallic# EQ 1)>checked="checked"</cfif> type="checkbox" name="Metallic" id="Metallic" value="1" />
i can get it for i checkbox that takes the value from one column with one value.
I have also some thing like that:
<input type="checkbox" name="Besonderheiten" value="text1" />
<input type="checkbox" name="Besonderheiten" value="text2" />
<input type="checkbox" name="Besonderheiten" value="text3" />

Where Tex1,Text2,Text3 are values stored in one comn(text1,text2,text3)
0
Panos
Asked:
Panos
  • 3
  • 2
1 Solution
 
srikanthmadishettiCommented:
<cfquery  datasource="" name="data">
select val from tbl_tasks
</cfquery>

<cfset vallist = valuelist(data.val,',')>

<input type="checkbox" name="test" <cfif listfind(vallist ,1)> checked </cfif> value="1" >

valuelist takes queryname.column name and the delemiter and creates a list with all values of that column then check with cfif statemnt listfind in each checkboc input statement
0
 
PanosAuthor Commented:
Hallo
If table is :artikel
  column :Besonderheiten
  Text     :ABS,ESP
  checkbox group :besonderheiten
What is he exactly code i must use?
thx
panos
0
 
hieloCommented:
Refer to the code below:
<cfquery datasource="panosSQL" name="q">
select Besonderheiten from artikel
</cfquery>
<form action="thisForm.cfm" method="post">
<cfoutput query="q">
	<cfif Besonderheiten is "ABC" OR Besonderheiten is "ESP">
		<input type="checkbox" checked="checked" name="besonderheiten" value="#Besonderheiten#"><br>
	<cfelse>
		<input type="checkbox" name="besonderheiten" value="#Besonderheiten#"><br>	
	</cfif>
</cfoutput>
</form>

Open in new window

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
srikanthmadishettiCommented:
<cfquery  datasource="" name="data">
select Besonderheiten from artikel
</cfquery>

<cfset vallist = valuelist(data.Besonderheiten,',')>

<input type="checkbox" name="Besonderheiten" <cfif listfind(vallist,'ABC')> checked </cfif> value="ABC" >
<input type="checkbox" name="Besonderheiten" <cfif listfind(vallist,'ESP')> checked </cfif> value="ESP" >
0
 
PanosAuthor Commented:
Hallo hielo.
I think i must find something like srikanthmadishetti has written.
I have the possibility to check 40 checkboxes in a checkbox group.
It is easear to have a cfif tag that is checking if a spesific text value exist in a column.
I have checked it out but i have not get it working.I have no numbers in the column,only text.
thx
panos
0
 
PanosAuthor Commented:
Hallo srikanthmadishetti .
Your code is working fine
Thank you.
panos
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now