danilda
02-14-2003, 08:16 PM
I am trying to change the maxlength of an input text field based on the value of another field. I can get the size property to work, but not the maxlength. Can someone tell me what I am doing wron? Thanks for your help -- dee
JAVASCRIPT CODE:
function sizeit()
{
if(document.form.change.options[document.form.change.selectedIndex].value == "NPIN")
{
document.form.accession.size = 4
document.form.accession.maxlength = 4;
}
if(document.form.change.options[document.form.change.selectedIndex].value == "ASHA")
{
document.form.accession.size = 6
document.form.accession.maxlength = 6;
}
}
HTML CODE:
<select name="change" onChange="return sizeit();">
<option value="1" selected>Please choose a Change Type</option>
<option value="NPIN">NPIN</option>
<option value="ASHA">ASHA</option>
</select
<b>Accession #</b> <input type="text" name="accession" size="6" maxlength="6">
JAVASCRIPT CODE:
function sizeit()
{
if(document.form.change.options[document.form.change.selectedIndex].value == "NPIN")
{
document.form.accession.size = 4
document.form.accession.maxlength = 4;
}
if(document.form.change.options[document.form.change.selectedIndex].value == "ASHA")
{
document.form.accession.size = 6
document.form.accession.maxlength = 6;
}
}
HTML CODE:
<select name="change" onChange="return sizeit();">
<option value="1" selected>Please choose a Change Type</option>
<option value="NPIN">NPIN</option>
<option value="ASHA">ASHA</option>
</select
<b>Accession #</b> <input type="text" name="accession" size="6" maxlength="6">