Default radio button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • taunt
    New Member
    • Jan 2012
    • 7

    Default radio button

    Hello I'm trying to make a sertain radio button the default. How would I get about doing this? Here is my coding so far:

    Code:
    <td>	
        	Edit&nbsp;<input type="radio" name="Ptype" value="Edit"<cfif #Session.PType# IS "Edit">CHECKED</cfif> onClick="this.form.submit();">&nbsp;&nbsp;&nbsp;Print&nbsp;<input type="radio" name="Ptype" value="Print"<cfif #Session.PType# IS "Print">CHECKED</cfif> onClick="this.form.submit();"></font>	
    	</td>
    I want the default to be edit. If print is selected and the page reloads it will try to print again. I tried to do

    Code:
    <cffunction name="setDefaultProperties"> 
    <cfset "PType" IS "Edit">
    </cffunction>
    With no luck. Any help would be great.
    Thanks
    Last edited by acoder; Jan 18 '12, 02:58 PM. Reason: Added [code] tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    PType needs to be in the Session scope. Also, you'd use = in <cfset>, not IS.

    Comment

    • taunt
      New Member
      • Jan 2012
      • 7

      #3
      Speaking of the session scope. I just looked at it and:

      <cfparam name="Session.P Type" default="edit">

      So it's set as the default. My issue is when the page loads it won't go back to edit. Do I need to do a onload maybe?

      Comment

      Working...