![]() |
|
Grabbing and comparing form values [Javascript / HTML] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5) +---- Thread: Grabbing and comparing form values [Javascript / HTML] (/showthread.php?tid=5356755) |
Grabbing and comparing form values [Javascript / HTML] - poodlefun - Jul 29, 2016 How would I make it so if the visitor submits the name gerald it will write "wow" to the page quite confused at the moment, if anyone could assist me using newbie terms that'll be great! Here's what I got so far pastebin.com/mcN3FF3G what am I doing wrong ;c * - Corios - Jul 29, 2016 First, it should be ===, not just =, and when do you expect this JavaScript to run? Does it have to be a form submit? Are you actually meaning to go back to the server? If so you need to add a click event on the button and cancel form submission, then renewable it if their name isn't Gerald. If you don't actually need form submission, delete the form and remove the submit values and just have your click event. * - poodlefun - Jul 29, 2016 i do not understand a single word of that. i just want it to do something if the textbox has a certain name inside after clicking submit, thanks anyway. * - Infinity. - Jul 30, 2016 PHP Code * - Two-Ton 21 - Jul 30, 2016 A single equal sign is only for setting values. Above, he's explaining you need to use two equal signs to compare value and three to compare exact values including capitals. True==true is true but true===1 would not be true. Tue==1 will output true. So in your case use (param == 'Gerald'). Js version of above: Code function isGerald(param) |