Solved

Coldfusion - showing initial value in radio button selection on form

Posted on 2008-10-03
7
324 Views
Last Modified: 2012-08-14
I have a Coldfusion form that includes a radio button.  When I want to update a record, I can pull in all the original values into every form except the radio button. Is there a way to set the value of the radio buttons to what is in the database?
0
Comment
Question by:ServalStudios
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22636086
sure it can be done
Once you get you query you just say this
<input type="radio" name="xxx" <cfif query.filedname eq 1>checked</cfif>>

0
 
LVL 1

Author Comment

by:ServalStudios
ID: 22636406
I think we are close, but still not working..
my query is called "update" and my field is called "region", so I have

<cfif update.region eq 1>checked</cfif>

Would it be 1, or should it be something like text value in the field?
Thanks
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22636435
what is the value that get store in region (1, yes , no and so on )
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:ServalStudios
ID: 22636748
so if it is a value like "house" do I put eq "house" or?
0
 
LVL 19

Accepted Solution

by:
erikTsomik earned 250 total points
ID: 22636774
<input type="radio" name="xxx" value="house"<cfif query.filedname eq "house">checked</cfif>>
<input type="radio" name="xxx" value="village"<cfif query.filedname eq "village">checked</cfif>>

0
 
LVL 25

Expert Comment

by:dgrafx
ID: 22636932
<cfset fieldlist="car,house,boat,hole in the ground">
<cfloop list="#fieldlist#" index="ii">
      <input type="radio" name="xxx" value="#ii#"<cfif query.xxx is ii>checked</cfif>>#ii#<br>
</cfloop>
0
 
LVL 1

Author Closing Comment

by:ServalStudios
ID: 31502852
Thank you.. works great
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

Need Help in Real-Time?

Connect with top rated Experts

29 Experts available now in Live!

Get 1:1 Help Now