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. 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? 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. 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? 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
Archived
This topic is now archived and is closed to further replies.