Skip to main content
May 12, 2008
Question

dynamic checking of radio and checkboxes

  • May 12, 2008
  • 1 reply
  • 277 views
On CF8, my existing code of determining whether to dynamically have a radio button or checkbox checked doesn't seem to be working.

Here's my workaround that I'm using now:

<cfif StructKeyExists(cookie.sitename_rememberme)>
<cfinput type="radio" name="returning_cust" value="1" checked="yes">
<cfelse>
<cfinput type="radio" name="returning_cust" value="1" checked="no">
</cfif>

In the past, I would have done something like:
<input type="radio" name="returning_cust" value="1"<cfif StructKeyExists(cookie.sitename_rememberme)> checked="yes"</cfif>>




    This topic has been closed for replies.

    1 reply

    Inspiring
    May 12, 2008
    The correct syntax is checked="checked".

    My approach would be to create a variable first and then output it in your tag.