By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,256 Members | 1,700 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,256 IT Pros & Developers. It's quick & easy.

radio button problem

P: 38
i have radio type html control....i select on radio button and click on select button it is redirected to next page...if i click on back button again i back on radio button page... then one of the previous radio button is looking selected... but i click again on select give alert box ..plz select record..? my code is here.

Expand|Select|Wrap|Line Numbers
  1. var isRadioSeleted='';
  2.             function Selected()
  3.             {    
  4.                 isRadioSeleted = "yes";
  5.             }
  7.             function ValidateSelection()
  8.             {
  9.                 if(isRadioSeleted=='')
  10.                 {
  11.                 alert('Please select a record');
  12.                 return false;
  13.                 }
  14.             }
how to avoid this message when this radio button is looking selected?
Mar 6 '09 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 16,027
I assume the Selected() function is called when the radio button is selected. Instead of setting a string variable, change the Selected() function to check that a radio button is selected and return true/false and use that in the if statement:
Expand|Select|Wrap|Line Numbers
  1. if (!isSelected()) {...
Mar 6 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.