I've seen various ways to populate form fields using javascript and radio button, text fields, and text areas but thus far i've been unable to do it via input buttons. Any help would be appreciated. I'm no javascript guru.
What I've tried in various forms is the following which produced an undefined output.
Code:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en-GB"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>hello whirled</title> <script type="text/javascript"> function populateTheOtherInputField() { document.groovyform.serviceField.value = document.groovyform.service.value; } </script> </head> <body onLoad="myOnloadEvent();"> <form name="groovyform"> <input type="button" onclick="populateTheOtherInputField()" value="Test" name="service"> <input type="button" onclick="populateTheOtherInputField()" value="Run" name="service"> <input type="text" id="serviceField" name="serviceField"> </form> </body> </html>



Reply With Quote

Bookmarks