Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checked radio button with cfif

Status
Not open for further replies.

bataraguru

Programmer
Jun 4, 2002
37
MY
Hi,
I want to make a radio button checked on form load.
I'm trying to use cfif, but I don't know whether my coding is correct or do I missed something. My server returns error on this code line.

Here is my code:
Code:
<cfinput name=&quot;mod_category&quot; type=&quot;radio&quot; value=&quot;#Category_ID#&quot; 
<cfif #find_topic.Category# eq #Category_ID#>
checked
</cfif>
>

Please advise

- zack -
 
A CF tag cannot be used between the brackets of another cf tag, otherwise your coding is correct..

<cfif find_topic.Category eq Category_ID>
<cfinput name=&quot;mod_category&quot; type=&quot;radio&quot; value=&quot;#Category_ID#&quot;>
<CFELSE>
<cfinput name=&quot;mod_category&quot; type=&quot;radio&quot; value=&quot;#Category_ID#&quot;>
</cfif>

Hope this helps,
Tony
 
Thanks for your reply..
Dang.. I dont realize that..
I think I've got the answer.
I just change from:
Code:
<cfinput name=&quot;mod_category&quot; type=&quot;radio&quot; value=&quot;#Category_ID#&quot; 
<cfif #find_topic.Category# eq #Category_ID#>
checked
</cfif>
>
[code]
to
<input name=&quot;mod_category&quot; type=&quot;radio&quot; value=&quot;#Category_ID#&quot;
<cfif #find_topic.Category_ID# eq #Category_ID#>
checked
</cfif>
>
[/code]

: Just change cfinput to input :

Regards,
- zack -
 
That'll work to, but of course the you don't have the additional attributes that the cf counterpart to <INPUT> has..
 
Thanks webmigit,
Yes that one I know. I think I dont really need additional attributes for cfinput tag for this page.

Thanks again.

- zack -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top