What's Here?
- Members: 131,105
- Replies: 468,509
- Topics: 72,573
- Snippets: 2,532
- Tutorials: 661
- Total Online: 2,128
- Members: 67
- Guests: 2,061
Who's Online?
|
Check to see if a radio button or check box should be checked when editing data. Passes the value of the radio button and the data for that field and returns "checked" or nothing.
|
Submitted By: supersloth
|
|
Rating:

|
|
Views: 5,095 |
Language: ColdFusion
|
|
Last Modified: May 10, 2005 |
|
Instructions: See comments for instructions. |
Snippet
<!--- This function is used when loading data in to a form for editing purposes
there is often a need to check the radiobutton that was selected. Pass the stored
value (data) and compares it to the value (value) of that radio button. --->
<cffunction name="isChecked">
<cfargument name="data" required="yes" default="0">
<cfargument name="value" required="yes" default="1">
<!--- Clear the variable in case the function remains stateful --->
<cfset checkedTag="">
<cfif arguments.data is arguments.value>
<cfset checkedTag="checked">
</cfif>
<cfreturn checkedTag />
</cffunction>
<!---
Implementation:
<input type="radio" name="thisButton" value="SomeValue" #isChecked(data=thedata, value="SomeValue")#>
--->
Copy & Paste
|
|
|
Programming
Web Development
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|