Hi, I'm hoping someone can help me.
What I have is a form in an asp page that generates the name attribute of a text box. The text box has a default value of 0, I have a function that checks to make sure that there is some value in the box, but what I want to do is put a 0 back in if the field is left blank. The problem is I'm getting an error because the name is generated with text and a number. I can't figure out how to get the fieldname in the line of code: (document.projviewform.cat.value=fieldvalue
thanks for any help.
Here is the code I have:
<SCRIPT language="JavaScript">
function checkValue(fieldvalue,fieldname,counter)
{
alert(fieldvalue);
if (fieldvalue == ""
{
fieldvalue = 0;
alert(fieldname+counter);
cat = fieldname+counter;
alert(cat);
document.projviewform.cat.value=fieldvalue;
}
}
</SCRIPT>
<form name="projviewform" method="post" action="test.asp">
<% For count = 0 to 1%>
<input onblur="checkValue(this.value,'passField',<%=count%>);" type="Text" name="passField<%=count%>" value="0">
<%Next%>
</form>
What I have is a form in an asp page that generates the name attribute of a text box. The text box has a default value of 0, I have a function that checks to make sure that there is some value in the box, but what I want to do is put a 0 back in if the field is left blank. The problem is I'm getting an error because the name is generated with text and a number. I can't figure out how to get the fieldname in the line of code: (document.projviewform.cat.value=fieldvalue
thanks for any help.
Here is the code I have:
<SCRIPT language="JavaScript">
function checkValue(fieldvalue,fieldname,counter)
{
alert(fieldvalue);
if (fieldvalue == ""
{
fieldvalue = 0;
alert(fieldname+counter);
cat = fieldname+counter;
alert(cat);
document.projviewform.cat.value=fieldvalue;
}
}
</SCRIPT>
<form name="projviewform" method="post" action="test.asp">
<% For count = 0 to 1%>
<input onblur="checkValue(this.value,'passField',<%=count%>);" type="Text" name="passField<%=count%>" value="0">
<%Next%>
</form>