SeanFromIT Posted January 31, 2007 Share Posted January 31, 2007 Inside of an HTML form, does anyone know how to echo something immediately if a radio button with a certain value is pressed, without submitting the HTML form? Quote Link to comment https://forums.phpfreaks.com/topic/36552-radio-button-on-press-echo/ Share on other sites More sharing options...
fert Posted January 31, 2007 Share Posted January 31, 2007 Javascript or Ajax Quote Link to comment https://forums.phpfreaks.com/topic/36552-radio-button-on-press-echo/#findComment-174031 Share on other sites More sharing options...
JasonLewis Posted February 1, 2007 Share Posted February 1, 2007 i'd say javascript though. thats what javascript was sort of designed for. <form action="page.php" method="POST" name="form"> Click the checkbox: <input type="checkbox" value="Hello" name="checkbox" onclick="javascript: alert('Value: '+document.form.checkbox.value);"> </form> that should work. thats how i'd do it. Quote Link to comment https://forums.phpfreaks.com/topic/36552-radio-button-on-press-echo/#findComment-174358 Share on other sites More sharing options...
HuggieBear Posted February 1, 2007 Share Posted February 1, 2007 "Javascript or Ajax..." I'd say javascript though. thats what javascript was sort of designed for. For a start, what do you think the 'J' in aJax stands for, so by suggesting one over the other, you possibly haven't quite grasped the concept of it yet. In addition, my above comment aside, how can you make such an assumption without knowing what s/he wants to display. Suppose the radio button is a "Select your free gift" on the order form of their website... when they click the radio button the poster wants to check the database to see if there's any of that gift in stock, and if not display an image of a cross next to the button, or a tick if it is in stock. How do you do that in just Javascript alone? Regards Huggie Quote Link to comment https://forums.phpfreaks.com/topic/36552-radio-button-on-press-echo/#findComment-174489 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.