943,172 Members | Top Members by Rank

Ad:
Sep 1st, 2010
0

Radio Button onClick Javascript calling only once

Expand Post »
Dear all,
Let me tell you the scenario , i have called javascript function on radio button selection , Ex.
Suppose There are 3 Radio Button .
Let us consider i have clicked on one radio button then
javascript is called on that and
it get 'checked' But again if if i clicked on that radio ,
Then again it will call the javascript .
So i dont want to let it happen , If radio button value got changed then only javascript should call

Please help.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gskoli is offline Offline
13 posts
since May 2010
Sep 1st, 2010
0
Re: Radio Button onClick Javascript calling only once
Hi,

Some ideas here;

1) You can check the radio button value in the javascript and execute the action. for example like;
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. if (document.getElementById("RadioButton1").checked == true){<do action>}

2) Adding events for radio button in page_load()
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. RadioButton1.Attributes.Add("onclick", "javascript:return alertme();");

You can play with these and update us if you found the expected results.


Thank you.
Reputation Points: 23
Solved Threads: 26
Junior Poster
MeSampath is offline Offline
102 posts
since Oct 2009
Sep 3rd, 2010
0
Re: Radio Button onClick Javascript calling only once
Thanks to reply guys ,
Well i dint got expected result let me give you some snippet of the code.

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <input type='radio' name='productradio' id='proname' value='prod_name' onClick='document.frm.submit();' />Product Name&nbsp;&nbsp;
  2. -<input type='radio' name='productradio' id='procode' value='prod_code' onClick='document.frm.submit();' />Product Code&nbsp;&nbsp;
  3. -<input type='radio' name='productradio' id='cat_name' value='cat_name' onClick='document.frm.submit();' />Category Name&nbsp;&nbsp;
  4. -<input type='radio' name='productradio' id='cat_code' value='cat_code' onClick='document.frm.submit();' />Category Code

Now if i have selected Category Name and again i am selecting that
then form should not submit .
Last edited by gskoli; Sep 3rd, 2010 at 9:32 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gskoli is offline Offline
13 posts
since May 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Replace Content from AJAX Result (SACK)
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Parent/Child Windows References





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC