I've got this form on a JSP:
<form name="<%=formName%>" method="post" action="<%=actionURL%>" target="_parent" onsubmit="submitForm('<%=String.valueOf(isAbstract)%>','<%=formName%>'); return false">
Then I have the following Javascript in an include file:
function submitForm( isAbstract , formName ) {
var o = "document.forms['" + formName + "']";
var form = eval(o);
if (isAbstract)
{
alert("Error");
return;
}
if (!form.AutoName.checked)
{
if (form.name.value == "")
{
alert("Some text");
return;
}
}
}
Well, I reduced the functions to make it simpler, but the thing is that whatever I do, I keep getting undefined values for both arguments. This is driving me crazy, because I've got similar code on other tags that work just fine (except that it's on a combo box tag with the onChange
action).
Any thoughts, please?