TecTao Posted April 21, 2006 Share Posted April 21, 2006 I'm having a real problem writing part of a form that has three radio buttons to select a method of payment.The three radio buttons are the same name "pay" so that only one can be clicked.Second, they are required so one out of the three must be clicked to submit.Third, each radio button has a small text field to put, number attending, amount of check or phone number.What I need help on is to if one button isn't clicked, then the next or then next but one of the three must be required.thanks for any helpm Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 21, 2006 Share Posted April 21, 2006 You don't need any script for this. Simply have one of the radio buttons selected by default.<input type="radio" name="pay" id="pay" value="1" selected="selected">Number Attending<input type="radio" name="pay" id="pay" value="2">Cheque Amount<input type="radio" name="pay" id="pay" value="3">Phone Nummber(Odd for radio buttons as tehy don't seem connected - but hey its your form!) Quote Link to comment Share on other sites More sharing options...
TecTao Posted April 21, 2006 Author Share Posted April 21, 2006 Thanks for the input, but having the viewer select on of the buttons isn't the challenge. Each radio button has a corresponding text box to fill in something. One of those boxes must be required along with the radio button selection.So if the pick the first button "number attending" then they have to fill in the corresponding text field.If the select "Check Amount" then they have to fill in that corresponding text field.and the same for the last.None of the radio buttons are selected so they have to select one and fill in the text field info.Currently I'm using a java script to require text fields, but since I haven't been able to write or locate a java script for radio button selections, I'm considering the required field option using a php if else statement. Quote Link to comment Share on other sites More sharing options...
Orio Posted April 22, 2006 Share Posted April 22, 2006 You cant do it with php unless the text box will appear in the next screen.You will nee JS for this one. Use the onFocus and onBlur to do this.Orio. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.