Yammyguy Posted March 29, 2009 Share Posted March 29, 2009 Hello, I'm wondering if there's a way to submit the form information without needing to click the submit button. For example, I would like the page to re-load with the values as soon as someone's clicked a radio button, or selected the option from the drop down list. I would like to have that feature available in order to determine which options to display based on the user input. If you need some more information, or if anything's not clear, please let me know - and I'll try to elaborate. Thanks very much in advance! ~C. Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/ Share on other sites More sharing options...
MadTechie Posted March 29, 2009 Share Posted March 29, 2009 Yes you can do this, via AJAX Heres a basic idea from a dropdown list Dynamic DropDown PHP/AJAX I hope it helps Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796467 Share on other sites More sharing options...
Yammyguy Posted March 29, 2009 Author Share Posted March 29, 2009 Thanks for the reply, but I'm not sure this is what I'm looking for. Instead of having a bunch of radio buttons or a dropdown list and a submit button. I just want some radio buttons and once the button is selected the page refreshes with some new form elements based on the previous selection. After looking around, it seems it's only doable with javascript with the "OnClick" value. And I can't stand javascript. Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796488 Share on other sites More sharing options...
MadTechie Posted March 30, 2009 Share Posted March 30, 2009 If you don't want a re-load then yes your need some client side code (i.e. JS) if you don't mind a page reload then you can use onclick to submit the form (or trigger a ajax routine) onclick="javascript:form.submit()" Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796502 Share on other sites More sharing options...
Yammyguy Posted March 30, 2009 Author Share Posted March 30, 2009 If you don't want a re-load then yes your need some client side code (i.e. JS) if you don't mind a page reload then you can use onclick to submit the form (or trigger a ajax routine) onclick="javascript:form.submit()" Thanks! Obviously that's a js function, what would the function code be? I'm sorry, I can't figure out JS to save my life.. Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796526 Share on other sites More sharing options...
corbin Posted March 30, 2009 Share Posted March 30, 2009 submit() is the method of a form object. For example, if you had: <form name="some_form" id="some_form_id"> You could do: document.forms.some_form.submit(); or document.getElementById('some_form_id').submit(); to submit the form. Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796546 Share on other sites More sharing options...
Yammyguy Posted March 30, 2009 Author Share Posted March 30, 2009 submit() is the method of a form object. For example, if you had: <form name="some_form" id="some_form_id"> You could do: document.forms.some_form.submit(); or document.getElementById('some_form_id').submit(); to submit the form. Thank you very much for clearing this up. I've now got exactly what it is I wanted to get done. Again, you've all been a great help! ~C. Quote Link to comment https://forums.phpfreaks.com/topic/151665-solved-page-re-fresh-after-input/#findComment-796592 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.