Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

cfform radio buttons on an edit form

Posted on 2005-04-27
7
Medium Priority
?
1,027 Views
Last Modified: 2013-12-24
Hmm... ran into a new problem just now. Back when using simple <form>'s on my page, I used to include a line like this to select the correct radio button.

<input name="Status" type="radio" value="0" <cfif Consumer_Edit.Status eq 0>checked="checked" </cfif>/>

Using the cfif line to add my happy little checked value as needed. now I have converted these items to cfinput type=radio and I am not sure how I would go about this using the cfinput. This code is on an edit form .. so I need to make sure the right radios are preselected.

<cfinput type="radio" name="Gender" value="M" />
M
<cfinput type="radio" name="Gender" value="F" />
F
<cfinput type="radio" name="Gender" value="U" checked="true" />
Unselected

0
Comment
Question by:mcsolas
  • 3
  • 2
  • 2
7 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 13880142
<cfinput type="radio" name="Gender" value="U" <cfif Consumer_Edit.Status eq 0>checked="true"</cfif> />
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 13880160
Whoops - not that with cfinput.

Try this:

<cfinput type="radio" name="Gender" value="U" CHECKED="Yes/No"  />

Then to set the Checked you can do:

<cfset checked = Consumer_Edit.Status eq 0>
<cfinput type="radio" name="Gender" value="U" CHECKED="#checked#"  />

OR
<cfinput type="radio" name="Gender" value="U" CHECKED="#IIF(Consumer_Edit.Status eq 0, "Yes", "No")#"  />
0
 
LVL 1

Author Comment

by:mcsolas
ID: 13880196
I just tested this .. you cant nest a cf tag inside another one. Hence the reason for the post.
0
Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

 
LVL 1

Author Comment

by:mcsolas
ID: 13880272
<cfinput name="Status" type="radio" value="-1" checked="#IIF(Consumer_Edit.Status eq -1, "Yes", "No")#" />

Just tried this one too .. came back with an odd enough error: Variable No is undefined.

I was hoping that would work, that looked good to me.
0
 
LVL 3

Expert Comment

by:Meps
ID: 13880282
I don't know if this would be possible, I think you can't nest a cfif in a cfinput, but the other way works if I remember right.  Try this.

<cfif Consumer_Edit.Status eq 0>
<cfinput type="radio" name="Gender" value="U" checked="true" />
<cfelse>
<cfinput type="radio" name="Gender" value="U" checked="false" />
</cfif>
0
 
LVL 3

Accepted Solution

by:
Meps earned 2000 total points
ID: 13880335
Try this
<cfinput name="Status" type="radio" value="-1" checked="#IIF(Consumer_Edit.Status eq -1, DE('Yes'), DE('No'))#" />
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 13880399
Whoops forgot the DE function as Meps pointed out....
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question