View Single Post
  #9 (permalink)  
Old August 2nd, 2003, 05:16 AM
mateenmohd mateenmohd is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks you for your help.

regards.

Quote:
quote:Originally posted by cpap
 my friend the line onsubmit=....... MUST be placed in the <input type='submit'.....> of your HTML Code.

regards
Chris...

Quote:
quote:Originally posted by mateenmohd
 thanks for response.
I amend the coding,but it is move to next page.
it is not stop that field.
I remove onClick attribute from the button.
Please check coding
<head>
<script language=JavaScript>
function doCheck()
{
for (i=0;i<=1;++i)
{
fx=document.forms[0].elements[i].value
fn=document.forms[0].elements[i].name
if (i==0)
{
fn=document.forms[0].elements[i].value
    if ( /[^0-9]/.test(fn) )
{
alert ("Please enter Numeric Value ")
onSubmit="return doCheck()"
return false;
}
}
}
document.myform.submit()
}
</script>
</head>




Quote:
quote:Originally posted by planeswalk
 Hi,

This is because you have document.myform.submit() after the regular expressions code block. The first thing that you need to do is remove that line from the javascript. Then type onSubmit="return doCheck()" as an attribute in your <form> tag (you have to have this) and remove the onClick attribute from the button. This will force your HTML form to do the expression check when you submit the form and will not submit the page if the check fails.

Cheers!
Marlon

Reply With Quote