javascript_howto thread: Sending form info after checking fields with java scripting
That is correct, however you may have a user who does not have a JS
compatible browser or runs with JS off, unlikely but does happen. The extra
validation is also a belt & braces approach.
At 08:51 26/09/01 +0200, you wrote:
> >As mentioned by a previous poster, you should also validate on the server
> >side as some people will browse with JS off.
>
>Depends on your audience/target group.
>
>The user experience will be much better with an instant client-side
>validation,
>and it also decreases the load on the server substantially.
>
>
>/Robert
>
>
>
>-----Original Message-----
>From: Greg Griffiths [mailto:griffiths@x...]
>Sent: den 25 september 2001 21:53
>To: JavaScript HowTo
>Subject: [javascript_howto] Re: Sending form info after checking fields with
>java scripting
>
>
>to submit it try ;
>
>document.<form name>.submit()
>
>As mentioned by a previous poster, you should also validate on the server
>side as some people will browse with JS off.
>
>At 17:29 25/09/01 +0000, you wrote:
> >Hi,
> >
> >I'm having some problems with a little trick I'd like to do. I am trying
> >to send information from a form to an e-mail address after having sent it
> >through some script, which should check that the mandatory fields have
> >been filled in.
> >
> >I was finding that it would send the form anyway despite having told the
> >user that a field had not been filled in.
> >
> >So, I changed my submit button to a normal button.
> >
> >I realise that I need to insert some script after my "Thankyou" message
> >box to basically continue the mailto action. But, I don't know quite how
> >to do this.
> >
> >Below is my script and the head and tail ends of my form as they are at
> >the moment. Does anyone have any suggestions???
> >
> >Thanks,
> >Michaela
> >
> ><script language="javascript">
> ><!-- Hide
> >
> >function test1(form) {
> > if (form.contactname.value=="")
> > alert("Please enter your name!")
> >
> > else if (form.emailaddress.value=="")
> > alert("Please enter your e-mail address!")
> >
> > else {
> > alert("Thank you, your details will be processed as soon
> >as possible");
> > }
> >}
> >//-->
> ></script>
> >
> >
> ><form name="contactinfo" enctype="text/plain" method=post action="">
> ><table>
> >.....
> >.....
> ></td> <td><input type="button" value="Mail it!" onClick="test1
> >(this.form)"></td>
> ><td></td> <td><input type="reset" value="Clear"></td></tr>
> ></table>
> ></form>