Re: Validation script is being bypassed by Jack
Jack
Thu Jan 06 16:07:03 CST 2005
Thanks Ray for your help here. I am going to try it. It seems that this may
be a good point to start javascript stuff. However, there is a lot of mental
resistance to its acceptance. Regards.
"Ray Costanzo [MVP]" wrote:
> Damn it. Make that:
>
> <form onsubmit="return validate(this);">
>
> --
>
> Ray at work
> Microsoft ASP/ASP.NET MVP
>
>
> "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
> message news:%23Iw5BfD9EHA.2124@TK2MSFTNGP10.phx.gbl...
> > <form onsubmit="validate(this);">
> > <input type="text" name="txt_CurrentOutlay" />
> > <input type="submit" value="Save" />
> > </form>
> >
> > <script type="text/javascript">
> > function validate(theForm) {
> > if(theForm.txt_CurrentOutlay.value.length==0) {
> > alert('You must enter a number for current outlay field.');
> > return false;
> > } else {
> > return true;
> > }
> > }
> > </script>
> >
> >
> > Sorry! Couldn't resist!
> >
> > --
> >
> > Ray at work
> > Microsoft ASP/ASP.NET MVP
> >
> >
> > "Jack" <Jack@discussions.microsoft.com> wrote in message
> > news:DF826D3F-3B8D-4F6F-B6F3-7D406BF39B57@microsoft.com...
> > > I am trying to test a validation logic in one of the text field I
> > have in a
> > > form. The name of the text field is txt_CurrentOutlay. The save
> > button in the
> > > form is coded as follows:
> > >
> > > <input type="submit" value="Save" name="btn_Save" >
> > > The name of the form is frmMain
> > >
> > > The validation logic code is written as :
> > > If (Len(document.frmMain.txt_CurrentOutlay.value) = 0) Then
> > > MsgBox "You must enter a number for current outlay field."
> > > Exit Sub
> > > End If
> > >
> > > Now, if I intentionally, do not put any value to the above field
> > and save, I
> > > do not get any message as per the validation scirpt above. I am
> > wondering
> > > where am I going wrong here? The txt_CurrentOutlay is tagged to a
> > table field
> > > in Access as currency field. Any help is appreciated in advance.
> > Thanks.
> > >
> >
> >
>
>
>