RogerInHawaii Posted June 19, 2007 Share Posted June 19, 2007 I want to effectively do a Post type submit to the very same page when the user clicks on a particular radio button. Of course, I also want it to recognize the click (i.e. checkmarking the radio button) first so the new status of that readio button gets properly Posted. How do I do that? Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/ Share on other sites More sharing options...
teng84 Posted June 19, 2007 Share Posted June 19, 2007 what?? you want a radio button to do the submitting stuff or select a radio button then click the submit button which is the usual thing ASTIG!!! Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278070 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 This would take javascript....let me see if I can find it on google for you. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278079 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 Ah, found it. <form id="Form1" action="<?=$_SERVER['PHP_SELF'] ?>" method="post"> <input type="radio" onchange="document.getElementById('Form1').submit()"> </form> You need to give your form an "id", then you can use the javascript onchange function. Just use the code above as a reference. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278090 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 Ah, found it. <form id="Form1" action="<?=$_SERVER['PHP_SELF'] ?>" method="post"> <input type="radio" onchange="document.getElementById('Form1').submit()"> </form> You need to give your form an "id", then you can use the javascript onchange function. Just use the code above as a reference. are sure thats correct coz I think your dealing with html dom Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278093 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 Yes, it's correct....I even tested it myself, it works. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278094 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 i think its something like this <input type="radio" onchange="javascript:document.getElementById('Form1').submit();"> or javascript here---- document.getElementById('Form1').submit() ---- <input type="radio" onchange="submit()"> isnt it like that Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278095 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 All those ways might work...maybe there isn't a wrong way to do it between them all? I got the script I posted on a tutorial site, and tested it...so it works fine, I don't see why it wouldn't be a valid way. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278098 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 can you show the site Any way dont get mad at me I was just giving my idea the site plss. I havent use the code you posted if it works for you NP but site i want to learn the other way Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278108 Share on other sites More sharing options...
RogerInHawaii Posted June 20, 2007 Author Share Posted June 20, 2007 Yes, I want the radio button to do the submitting stuff, just as if the user had the a standard Submit button. What I want to accomplish is to have certain display fields updated when the radio button is clicked. In particular, I'm updating a "cost" field indicating how much the user has selected to purchase. I'll be applying this to checkboxes as well, but my first issue is with the radio button. I'm assuming that whatever solution applies to the radio button will also apply to the checkboxes. I'm aware that I could require the user to hit some kind of Submit button in order to updatethe page, but it would be sooooo nice if I could make it happen automatically when he histthe radio button (or checkbox, or other control that requires a refresh of the data on the page). Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278109 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 so the issue is before submitting??? then javascript can do that if you dont want to refresh the page when you click radio then u want to automatically check the chk boxes??? Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278115 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 You should probably post what you are trying to do in the JavaScript forum, you will get better replies, and more help =] Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278116 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 pocobueno1388 site plss Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278118 Share on other sites More sharing options...
pocobueno1388 Posted June 20, 2007 Share Posted June 20, 2007 The tutorial site? Sorry, but I have no idea how I would find it again. I typed in so many things on google, and searched through so many sites that it would take me forever to find. You don't need it anyways, I copied and pasted the exact code that the tutorial gave. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278127 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 i dont mean any thing bro ijust thought i will learn new from what you have Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278129 Share on other sites More sharing options...
RogerInHawaii Posted June 20, 2007 Author Share Posted June 20, 2007 i think its something like this <input type="radio" onchange="javascript:document.getElementById('Form1').submit();"> I did it as <input type="radio" onClick="javascript:document.getElementById('Form1').submit();"> and it works like a charm. Thank you for the advice. Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278171 Share on other sites More sharing options...
teng84 Posted June 20, 2007 Share Posted June 20, 2007 ya !! ASTIG!!! Link to comment https://forums.phpfreaks.com/topic/56294-how-to-do-a-post-type-submit-when-user-clicks-a-radio-button/#findComment-278174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.