...

View Full Version : auto enter text based on text in another field



MaryNovack
03-26-2012, 04:19 PM
Hi,

I'm hoping this will be an easy one for you experts out there.

I am working on a convention registration form.

What I'm trying to do is have the text "50.00" pop into the COST field when any text (even if it's only one character) is entered into the NAME field.

If the text in the NAME field is deleted, the "50.00" should also be deleted.

Does anyone have a script that does this?

Thanks!

xelawho
03-26-2012, 04:39 PM
like this?


<body>
name: <input type="text" onkeyup="checkName(this.value)"/>
cost: <input type="text" id="cost"/>
<script type="text/javascript">
function checkName(name){
document.getElementById("cost").value=name?"$50.00":"";
}
</script>
</body>

MaryNovack
03-26-2012, 04:47 PM
GENIUS!!!!

Thank you - it works like a charm :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum