0 Replies - 1587 Views - Last Post: 10 May 2005 - 12:33 PM

#1 supersloth   User is offline

  • serial frotteur - RUDEST MEMBER ON D.I.C.
  • member icon

Reputation: 4678
  • View blog
  • Posts: 28,500
  • Joined: 21-March 01

isChecked Function

Posted 10 May 2005 - 12:33 PM

Description: See comments for instructions. 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.
 <!--- 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">
        <cfreturn checkedTag />
<input type="radio" name="thisButton" value="SomeValue" #isChecked(data=thedata, value="SomeValue")#> 

Is This A Good Question/Topic? 0
  • +

Page 1 of 1