Click to See Complete Forum and Search --> : Autofilled textfields (urgent!)


littleInca
07-29-2003, 04:35 PM
I have several textfields on my jsp page. How do i autofill the rest of them with a default value, if user enters the value for one of the textfields. :confused:

Thank you!!!!!

pyro
07-29-2003, 04:45 PM
What exactly do you need? When do you need these default values to appear?

littleInca
07-29-2003, 04:49 PM
just a number

if i enter something in textfieldA, then textfieldB, textfieldC, textfieldD will have the value 90 appear in their fields. but if textfieldA is empty, then the rest of the textfields stay empty as well. user are free to change the value of the rest of the textfields as they wish.

pyro
07-29-2003, 04:54 PM
This, perhaps?

<script type="text/javascript">
function setVals() {
frm = document.myform;
frm.textfieldB.value = 90;
frm.textfieldC.value = 90;
frm.textfieldD.value = 90;
}
</script>
</head>
<body>
<form name="myform">
<input type="text" name="textfieldA" onkeydown="setVals();">
<input type="text" name="textfieldB">
<input type="text" name="textfieldC">
<input type="text" name="textfieldD">
</form>