john2020 Posted February 13, 2011 Share Posted February 13, 2011 I have a form on a PHP page which has 11 groups of radio buttons. Is there way to use PHP instead of client-side JavaScript to submit the form values only when one radio button has been selected from each of the 11 groups? Also, is it possible to get the form elements in a PHP page with JavaScript? Why does this JavaScript: myForm.elements.length stop working in a PHP page? I thought it wouldn't affect client-side JS since PHP is server-side code. Thank you! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 13, 2011 Share Posted February 13, 2011 You should be validating server-side and not just checking with JS to begin with. JS is not validation. However it's impossible to say how without seeing the code. For your second question, php doesn't cause any javascript to not work. You'd need to examine the underlying html source and see what's causing it. Quote Link to comment Share on other sites More sharing options...
john2121 Posted February 13, 2011 Share Posted February 13, 2011 I agree that validation should be done server-side but this is a different scenario. In this case the users are a captive audience of inside company professionals and the only validation they want is that the form should be submitted once all of the questions has been answered by selecting a radio button answer. They don't want any other validation. I have figured out how to submit the form with JavaScript after all the questions have been answered but I was wondering if PHP has a similar mechanism. Perhaps,not because this seems to be a client-side issue unless AJAX is used to communicate with the server. 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.