[Zope] validation-onClick

Angietel angietel@hotmail.com
Thu, 23 Nov 2000 16:32:29 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_000A_01C0556A.F8F87260
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

The form=3D"a" and its input field=3D"custid" is being validated, when =
the alert message box came out then i clicked on the 'OK' button which =
is inside the alert message box, but it return to another page instead =
return to form=3D"a".
( I prefer to use 'onClick' instead of 'onSubmit' )

The following is my JavaScript validation function:-

function checkid()
{
if(document.a.custid.value=3D=3D""&&document.a.custname.value=3D=3D"")
{
alert("You must specify string character either in customer id or =
customer name.")
document.a.custid.focus();
return false;
}
}



The form events:-

<input type=3D"SUBMIT" name=3D"Search" value=3D"Search" =
onClick=3D"JavaScript:checkid()" >=20

------=_NextPart_000_000A_01C0556A.F8F87260
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>The form=3D"a" and its input =
field=3D"custid" is being=20
validated,&nbsp;when the alert message box came out&nbsp;then&nbsp;i =
clicked on=20
the 'OK' button which is inside the alert message box, but it return to =
another=20
page instead&nbsp;return to form=3D"a".</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>( I&nbsp;prefer&nbsp;to use 'onClick'=20
instead&nbsp;of 'onSubmit' )</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The following is my JavaScript =
validation=20
function:-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>function=20
checkid()<BR>{<BR>if(document.a.custid.value=3D=3D""&amp;&amp;document.a.=
custname.value=3D=3D"")<BR>{<BR>alert("You=20
must specify string character either in customer id or customer=20
name.")<BR>document.a.custid.focus();<BR>return=20
false;<BR>}<BR>}<BR></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The form events:-</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&lt;input type=3D"SUBMIT" =
name=3D"Search"=20
value=3D"Search" onClick=3D"JavaScript:checkid()"=20
&gt;</FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_000A_01C0556A.F8F87260--