The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages - More
> ColdFusion Development
|
Homework - Error Formating Radio Button
Discuss Error Formating Radio Button in the ColdFusion Development forum on Dev Shed. Error Formating Radio Button ColdFusion Development forum discussing CFML coding practices, tips on CFML, and other CFML related topics. Find out why ColdFusion is the tool of choice for many e-commerce developers.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

March 23rd, 2011, 08:43 PM
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 2
Time spent in forums: 23 m 39 sec
Reputation Power: 0
|
|
|
Homework - Error Formating Radio Button
Hi,
I have to show the user a form which he has submitted earlier. All the data has been saved to the database. The purpose of the form is to allow the authenticated user to edit the form fields.
One of the form field is a radio button, And I could input the values from the database to the form, shown to the user. The only error the form page has it doesn't properly format the radio buttons.
The code is as follows:
<input type = "radio" class = "button" value = "1"
<Cfif x = 1>Checked</CFif>YES
<input type = "radio" class = "button" value = "0"
<Cfif x = 0>Checked</CFif>NO
The code is inputing the values correctly from the database, the problem is:
() ()NO
Consider () as radio buttons, I am getting the form in the above format if the value of the variable is NO.
If it is YES, then it shows up as:
()YES ()
These is the error. Please help me with some valuable suggestions.
Vijayvijay77.
|

March 25th, 2011, 09:19 AM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
Are you actually ending the <input> tag? Note the ending tag brackets I added:
Code:
<input type = "radio" class = "button" value = "1"
<Cfif x = 1>Checked</CFif> />YES
<input type = "radio" class = "button" value = "0"
<Cfif x = 0>Checked</CFif> />NO
|

March 28th, 2011, 08:20 AM
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 27
Time spent in forums: 4 h 41 m 25 sec
Reputation Power: 0
|
|
May also want to group them with a name field so the user cannot check them both.
Code:
<input type = "radio" class = "button" name = "myRadios" value = "1"
<Cfif x = 1>Checked</CFif> />YES
<input type = "radio" class = "button" name = "myRadios" value = "0"
<Cfif x = 0>Checked</CFif> />NO
|

March 28th, 2011, 01:04 PM
|
|
Registered User
|
|
Join Date: Mar 2011
Posts: 2
Time spent in forums: 23 m 39 sec
Reputation Power: 0
|
|
|
I got the solution to it,
If I was using the <cfif> tag inside the Input tag, it was selecting me the right yes/no option but the problem of formating still existed.
But, I used the following format:
<cfif> conditions
<cfinput> tag
<cfelse>
<cfinput> tag
These format gave me the right result with right format!!
And if anyone is stuck with the same problem let me know.
Thanks so much for the replies, I really appreciate the help.
Thank You,
Vijayvijay77.
|

March 30th, 2011, 02:52 PM
|
|
|
not

__________________
ColdFusion Ninja 4 Hire!
|

March 30th, 2011, 04:10 PM
|
|
Moderator
|
|
Join Date: Jun 2002
Location: Raleigh, NC
|
|
|
Good call, though if you are on CF 9 (and maybe 8, I can't remember) you can also use the more common operators like ==, ++, --, &&, ||, etc.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|