Im sure i have done this before. Looks like it should work to me, would apreciate some assistance. My objective is to name and validate a form using the word assess & <%= getInfo(0) %> which is a unique number (yes there are multiple forms on the page, would like it to remain so)
The form tag is:
<form name="assess<%= getInfo(0) %>" method="post" action="<%= URLBase %>assess.asp" onSubmit="return val('assess<%= getFics(0) %>');">
When I view source I get
<form name="assess1" method="post" action="http://localhost/MHQ-MC/assess.asp" onSubmit="return val('assess1');">
This calls the following
JS function:
function val(formName)
{
if(document.formName.oAssess.selectedIndex==0)
{
alert("You must...");
document.formName.oAssess.focus();
return(false);
}
return(true);
}
The above function fails to enter the if condition if no selection has been made. The value is being passed, I can alert this no problem using alert("formName"); in the above function. The problem is in the function and not before, I know this also because this works fine:
function val(formName)
{
if(document.assess1.oAssess.selectedIndex==0)
{
alert("You must...");
document.assess1.oAssess.focus();
return(false);
}
return(true);
}
Is what I am trying to do possible? Im sure it is and hope I have missed something.
TYIA
Wind is your friend
Matt