Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues > ColdFusion

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-07-2011, 09:39 PM   PM User | #1
taunnt
New to the CF scene

 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
taunnt is an unknown quantity at this point
Default to a radio button onclick or onload

Hello I can't figure out how to code this. Right now I have 3 radio buttons edit/print/search. I need it to go back to the edit radio button either onclick or onload. Don't know what would be better. My codding looks like this so far:

<input type="radio" name="radiooption" value="Edit"<cfif #Session.radiooption# IS "Edit">CHECKED</cfif> onClick="this.form.submit();">Print<input type="radio" name="radiooption" value="Print"<cfif #Session.radiooption# IS "Print">CHECKED</cfif> onClick="this.form.submit();">search<input type="radio" name="radiooptione" value="search"<cfif #Session.radiooption# IS "search">CHECKED</cfif> onClick="this.form.submit();"></font>

<input type="button" name="ClearLabels" value="Clear Labels" style="font-size: 9px;" onClick="this.form.submit();">

What I need done in the end is when Clear Labels is clicked. I need it to clear the label que (which it does that now), but I need it to also go back to the edit radio (#Session.radiooption# IS "Edit") radio button. What would the best way to do this be?
taunnt is offline   Reply With Quote
Old 06-08-2011, 01:19 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
I don't know what <cfif> is so I have left them out of answer.
2. I put things in lower case because that's how their should be.
3. I am guessing, because you are submitting form for every action, that your page is being re-displayed all the time. So the answer is in the way the radio buttons are displayed:
Code:
Edit  <input type="radio" name="radiooption" value="Edit" checked="true" onclick="this.form.submit();">
<br />
Print <input type="radio" name="radiooption" value="Print" onclick="this.form.submit();">
<br />
Search<input type="radio" name="radiooption" value="search" onclick="this.form.submit();">
sunfighter is offline   Reply With Quote
Old 06-08-2011, 04:18 PM   PM User | #3
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
@sunfighter: If you don't know what <cfif> is, then you probably shouldn't answer questions in the ColdFusion forum However, good job on cleaning up that code...

@taunnt: What does your ColdFusion code look like that clears your label queue? Can you possibly just re-set session.radioOption back to "edit" when you clear your queue? (i.e. <cfset session.radioOption = "edit">)

Your HTML code should probably look like this in general though:
Code:
Edit <input type="radio" name="radioOption" value="Edit" onclick="this.form.submit();" <cfif session.radioOption eq "edit">checked="true"</cfif>><br />

Print <input type="radio" name="radioOption" value="Print" onclick="this.form.submit();" <cfif session.radioOption eq "print">checked="true"</cfif>><br />

Search <input type="radio" name="radioOption" value="search" onclick="this.form.submit();" <cfif session.radioOption eq "search">checked="true"</cfif>><br />

<input type="button" name="ClearLabels" value="Clear Labels" style="font-size: 9px;" onClick="this.form.submit();">
-Greg
Gjslick is offline   Reply With Quote
Old 06-08-2011, 05:34 PM   PM User | #4
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,387
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
Sorry. Didn't realize I was in Cold Fusion section
sunfighter is offline   Reply With Quote
Old 06-08-2011, 06:43 PM   PM User | #5
Gjslick
Regular Coder

 
Join Date: Feb 2009
Location: NJ, USA
Posts: 476
Thanks: 2
Thanked 70 Times in 69 Posts
Gjslick will become famous soon enough
Haha, all good man
Gjslick is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:36 PM.


Advertisement
Log in to turn off these ads.