Skip to main content
Participating Frequently
March 15, 2008
Answered

ISdefined for the checkbox

  • March 15, 2008
  • 1 reply
  • 1085 views
I have a form with 12 check boxes name sel1……sel12. I like to insert the once checked into a table. I’m using the following method to check for the boxes being defined.

<cfloop index="i" from="1" to="12">
<cfif isdefined(#form["sel" & i]#)>
Insert into table code here….
</cfif>
</cfloop>

In this case I have checked boxes with the name of sel1 and sel2, but not sel3 and that’s when I get this message.

Element sel3 is undefined in a Java object of type class coldfusion.filter.FormScope.

Thanks in advacne!
    This topic has been closed for replies.
    Correct answer Dan_Bracuk
    You don't use octothorps with isDefined. You might find it easier to give all your checkboxes the same name and different values. Then You just need
    <cfif isDefined("form.sel")>
    <cfloop list = "#form.sel#">
    code

    1 reply

    Dan_BracukCorrect answer
    Inspiring
    March 15, 2008
    You don't use octothorps with isDefined. You might find it easier to give all your checkboxes the same name and different values. Then You just need
    <cfif isDefined("form.sel")>
    <cfloop list = "#form.sel#">
    code
    soonersakAuthor
    Participating Frequently
    March 15, 2008
    Naming the checkbox same works great. Thank you!