Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi lovewebdev,
You can just put the condition directly in the checked attribute of your form field, like so:
<cfinput name="g" id="g" type="radio" value="1" required="yes" checked="#rs.g eq 1#" />
The checked attribute accepts True or False, so you can put any condition you'd like in there.
Daniel Short
Adobe Community Expert
Copy link to clipboard
Copied
Thanks!!!
Copy link to clipboard
Copied
Hi lovewebdev,
If I understand correctly what it is your trying to accomplish, try something like this.
<cfif rs.g eq 1>
<cfinput type="radio" checked="yes">F <cfinput type="radio" checked="no">M
<cfelseif rs.g eq 2>
<cfinput type="radio" checked="no">F <cfinput type="radio" checked="yes">M
</cfif>
So based on the value of the db column, the correct form elements will display
and the right one should be checked.
Leonard B
Copy link to clipboard
Copied
Use an input tag instead of a cfinput tag.