dynamic user input

R

reneeccwest

Hello,
The below code will be automatically filled and disabled in the user
input box when the usrinput field and one of the fields (which are
test1, test2, test3, test4, test5, and test5) is same.

But also I'd like to see the result that when the value (test1, test2,
test3, test4, test5, and test5) which is same as the usrinput field
is changed to a value which is not same as the usrinput field, I'd
like to make it and everything below of the field as empty. So I can
fill a different value there. Can anybody help on this extra feature?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>
<!--- != --->
<script language="JavaScript">

function updatethisform1() {
if (document.test.usrinput.value == document.test.field1.value){
document.test.field2.value = document.test.usrinput.value;
document.test.field3.value = document.test.usrinput.value;
document.test.field4.value = document.test.usrinput.value;
document.test.field5.value = document.test.usrinput.value;
document.test.field6.value = document.test.usrinput.value;

document.test.field2.disabled = true;
document.test.field3.disabled = true;
document.test.field4.disabled = true;
document.test.field5.disabled = true;
document.test.field6.disabled = true;
}

else if (document.test.usrinput.value == document.test.field2.value){
document.test.field3.value = document.test.usrinput.value;
document.test.field4.value = document.test.usrinput.value;
document.test.field5.value = document.test.usrinput.value;
document.test.field6.value = document.test.usrinput.value;

document.test.field3.disabled = true;
document.test.field4.disabled = true;
document.test.field5.disabled = true;
document.test.field6.disabled = true;

}

else if (document.test.usrinput.value == document.test.field3.value){
document.test.field4.value = document.test.usrinput.value;
document.test.field5.value = document.test.usrinput.value;
document.test.field6.value = document.test.usrinput.value;

document.test.field4.disabled = true;
document.test.field5.disabled = true;
document.test.field6.disabled = true;

}

else if (document.test.usrinput.value == document.test.field4.value){
document.test.field5.value = document.test.usrinput.value;
document.test.field6.value = document.test.usrinput.value;

document.test.field5.disabled = true;
document.test.field6.disabled = true;

}

else if (document.test.usrinput.value == document.test.field5.value){
document.test.field6.value = document.test.usrinput.value;

document.test.field6.disabled = true;

}
}

</script>

<form name="test" action="test.cfm" method="post">
TEST:<input type="text" name="usrinput" value=""><br><br>
TEST 1:<input type="text" name="field1" value=""
onchange="updatethisform1()"><br>
TEST 2:<input type="text" name="field2" value=""
onchange="updatethisform1()"><br>
TEST 3:<input type="text" name="field3" value=""
onchange="updatethisform1()"><br>
TEST 4:<input type="text" name="field4" value=""
onchange="updatethisform1()"><br>
TEST 5:<input type="text" name="field5" value=""
onchange="updatethisform1()"><br>
TEST 6:<input type="text" name="field6" value=""
onchange="updatethisform1()"><br>
<input type="Submit" value="submit">
</form>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top