radio button problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • avinash sh
    New Member
    • Feb 2009
    • 38

    radio button problem

    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 .....it give alert box ..plz select record..? my code is here.

    Code:
    var isRadioSeleted='';
                function Selected()
                {    
                    isRadioSeleted = "yes";
                }
    
                function ValidateSelection()
                {
                    if(isRadioSeleted=='')
    	            {
    	            alert('Please select a record');
    	            return false;
    	            }
                }
    how to avoid this message when this radio button is looking selected?
    Last edited by gits; Mar 6 '09, 08:52 AM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    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:
    Code:
    if (!isSelected()) {...

    Comment

    Working...