im working on a script for importing a small amount of data (2-3 fields) the values would be hard coded variables and automatically loaded into the text fields of a web form. i've started searching google and haven't been able to find anything usefully so far i'm familary with html and js but this seems alittle advanced for me, can someone point me in the right direction? provide a link? some sample code? the pro/cons of this? any input would be great
Why not just set the values in the field elements themselves? For example, <input name=TextBox1 id=TextBox1 value="Default_value"> Code (markup): as opposed to: <input name=TextBox1 id=TextBox1> <script> window.onload = function() { document.forms[0].TextBox1.value = "Default_value"; }; </script> Code (markup):
Yeah, if the values never change then don't go through the hassle of scripting them in, just use the value attribute on the form elements to accomplish the same goal.
The only reason you'd want Javascript for this is if these values are expected to be changed and you don't want your visitors to have the hassle of deleting the text first. There's a script floating around out there that removes the default value on mouse click or on (keyboard) focus. And actually, it doesn't even have to delete the text, but merely highlight it. Highlighted text gets replaced by whatever the next character typed in is anyway.
Hi all, I am looking for auto form fill up script probably in php. If any one can provide me, kindly contact me at . A javascript code can also satisfy my requirement. Thanks a lot in advance.