McMaster Posted May 29, 2012 Share Posted May 29, 2012 I am trying to change the value of the "human" field to 1 when the name field is onfocus but I cannot seem to get it to work. Here is the code I have for it... <form action="process.php" method="POST"> <input type="text" name="name" onfocus='document.getElementById("human").value="1"' /> <input type="hidden" name="human" id="human" value="0" /> <input type="submit" value="go" /> </form> Any help appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/263318-need-help-changing-an-input-value-onfocus/ Share on other sites More sharing options...
smerny Posted May 29, 2012 Share Posted May 29, 2012 what is happening that makes you believe it is not working? Quote Link to comment https://forums.phpfreaks.com/topic/263318-need-help-changing-an-input-value-onfocus/#findComment-1349481 Share on other sites More sharing options...
McMaster Posted May 29, 2012 Author Share Posted May 29, 2012 Well, when I click on the text input field and enter some text and then view the source code, the value of "human" is still set to 0, even when I refresh the source page. Quote Link to comment https://forums.phpfreaks.com/topic/263318-need-help-changing-an-input-value-onfocus/#findComment-1349483 Share on other sites More sharing options...
smerny Posted May 30, 2012 Share Posted May 30, 2012 you marked it as solved, what changed? Quote Link to comment https://forums.phpfreaks.com/topic/263318-need-help-changing-an-input-value-onfocus/#findComment-1349689 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.