beanymanuk Posted August 16, 2011 Share Posted August 16, 2011 I am testing this code I have found to change a hidden field but it works then i reload the page and it doesn't work I don't understand why Any ideas? Or another way of doing this that doesn't break Thankyou in advance <html> <body> <script type="text/javascript"> function changeHiddenInput (objDropDown) { var objHidden = document.getElementById("hiddenInput"); objHidden.value = objDropDown.value; } </script> <form> <select id="dropdown" name="dropdown" onchange="changeHiddenInput(this)"> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> <input type="hidden" name="hiddenInput" id="hiddenInput" value="" /> </form> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/244932-dropdown-changing-hidden-field-not-working/ Share on other sites More sharing options...
Adam Posted August 16, 2011 Share Posted August 16, 2011 Works fine for me (FF/IE6/Chrome). What browser are you using? Quote Link to comment https://forums.phpfreaks.com/topic/244932-dropdown-changing-hidden-field-not-working/#findComment-1258179 Share on other sites More sharing options...
beanymanuk Posted August 16, 2011 Author Share Posted August 16, 2011 FF 5.0 it works then I reload the page and it doesn't and then will randomly start working again and the code I posted is all that's on the page Quote Link to comment https://forums.phpfreaks.com/topic/244932-dropdown-changing-hidden-field-not-working/#findComment-1258187 Share on other sites More sharing options...
beanymanuk Posted August 16, 2011 Author Share Posted August 16, 2011 FF 5.0 it works then I reload the page and it doesn't and then will randomly start working again and the code I posted is all that's on the page Works in Chrome ok :s bizzare Quote Link to comment https://forums.phpfreaks.com/topic/244932-dropdown-changing-hidden-field-not-working/#findComment-1258189 Share on other sites More sharing options...
Adam Posted August 16, 2011 Share Posted August 16, 2011 If that's the only code, how are you checking whether it's working? Quote Link to comment https://forums.phpfreaks.com/topic/244932-dropdown-changing-hidden-field-not-working/#findComment-1258202 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.