Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using CFIF in CFINPUT radio tag

17 views
Skip to first unread message

lovewebdev

unread,
Apr 3, 2009, 3:12:36 PM4/3/09
to
I'm a little new to using cfinput. I always use HTML input.

I have radio buttons for gender. When the form is submitted, the value is
entered into a db column 1 or 2:
<cfinput name="g" id="g" type="radio" value="1" required="yes"
/>&nbsp;&nbsp;F<cfinput name="g" id="g" type="radio" value="2" />

I want to check one by default depending on the value stored in the db column
when the form loads.

I'm able to use a CFIF statement to check one by default in the HTML radio
like:
<cfif rs.g eq 1>checked="true"</cfif>

but you're not allowed to have cfif in a single cfinput tag.

How do I do it.

GArlington

unread,
Apr 6, 2009, 7:48:42 AM4/6/09
to

Define a var checkedStatus (or similar), set the value to
'checked="true"' or empty string depending in your if statement
and use <cfinput name="g" id="g" type="radio" value="2"
#checkedStatus# />

Dan Bracuk

unread,
Apr 8, 2009, 9:40:55 PM4/8/09
to
Why don't you simply use an input tag?

--
Dan Bracuk


0 new messages