<input onclick=validate not working?

it is not validating the amt1 input box?
Any idea why?


<script language="JavaScript" type="text/javascript">
            <!--
            function validate()
            {
                    if(document.test4.Amt1.value == '0')
                        {
                          alert('Please enter donation amount greater than $0');
                         document.test.Amt1.focus();
                        return false;
                        }
                  document.test4.submit();
            }
            //-->
            </script>

<form name="test4" style="color: #000080;" action="submit.asp" method="get">
<table style="width: 400px; height: 150px">
<tr><td colspan="2"></td></tr>
<tr><td>Program</td><td>
<select name="programURL">
<option value="">Select Program </option>
</select>
</td></tr>
<tr><td>Amount</td><td><input name="Amt1" size="8" maxlength="8" style="width: 70px; height: 20px;" class="style9" value="0"/></td></td></tr>
<tr><td colspan="2">
<input type="image" src="Donate.gif" border="0" name="submit" width="92" height="26" class="style5" onclick="javascript:validate();">

            
</td></tr></table>

</form>
dkim18Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
You probably need to put it in your form tag like this:

<form name="test4" style="color: #000080;" action="submit.asp" method="get" onsubmit="return validate();">
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wayne BarronAuthor, Web DeveloperCommented:
Why don't you use Server Side validation instead of JavaScript.

In this case, you could do something like this.

This will go on the process page.
<%
Amt1 = request.form("Amt1")
if Amt1=0 then
response.write"Please enter donation amount greater than $0"
else
' do what you need to do here.
end if
%>

Carrzkiss
0
H_D_ACommented:
what browser did you use for testing?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.