Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Several actions on a submit button


Message #1 by "kahine Kldon" <kahine@h...> on Wed, 29 Aug 2001 13:00:26 +0000
It's worth refering to the form by name <form name="myform" id="myform",
rather than its position in the array (document.form[0]), in case other
elements are added.

-----Original Message-----
From: kahine Kldon [mailto:kahine@h...]
Sent: 31 August 2001 11:26
To: javascript
Subject: [javascript] Re: Several actions on a submit button


Hi Peter!

Thank You very much  for your help. I will try it and let you know if I have

any problems.

Greets

Kahine


>From: peter.edwards@n...
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] Re: Several actions on a submit button
>Date: Fri, 31 Aug 2001 09:48:30
>
>There are a few ways to have multiple actions on submitting a form. One
>would be to call a function from the submit button:
><input type=button" value="submit" name="submit" onClick="submitForm();">
>Another would be to put an onSubmit event handler in the <form> tag:
><form name="form1" action="script.asp" onSubmit="return submitForm();">
>
>In the first case, you would do some processing with the form data,
>perform whatever actions you need to do, then call document.forms[0].submit
>(); to submit the form data to your script. In the second case, you would
>perform your actions, then return true; to submit the form (I like this
>one better because it's easy to put validation in and return false if
>things don't work out).
>
>In the case you have cited (email), you can either put a line of code in
>like this:
>location="mailto:someone@s...";
>or, if you are getting the address from the form:
>location="mailto:"+formEmail;
>This will start the default mail client on the users machine with the
>address you specify in the To: field.
>There is a way of sending mail using javascript but it produces security
>warnings (I think it involves changing the action of the form as well?
>maybe someone else could shed some light on this if you need it).
>
>If you want to send email without informing the user, the only way is to
>use the server script to do it.
>
>If you want to submit the form to two different scripts, you could open
>new windows for each script and pass data via the querystring to each one.
>
>Does this cover what you are attempting to do?
>
>
> > The problem is that I'm trying to do a script that could run on any OS
>and
> > Webserver with little changes. For that I need this script to be done on
> > JavaScript
> >
> > I've also been working on ASP but in this case I need it in JavaScript
> >
> > Thank You anyway
> >
> > Regards
> >
> > Kahine
> >
> >
> > >From: "Gerhard Wentink" <data@w...>
> > >Reply-To: "javascript" <javascript@p...>
> > >To: "javascript" <javascript@p...>
> > >Subject: [javascript] Re: Several actions on a submit button
> > >Date: Thu, 30 Aug 2001 06:10:49 +0200
> > >
> > >If you are able to use asp it is a peace of cake, because you can let
>the
> > >asp page send the email and handle the posted data.
> > >
> > >Regards,
> > >
> > >Gerhard Wentink
> > >----- Original Message -----
> > >From: "kahine Kldon" <kahine@h...>
> > >To: "javascript" <javascript@p...>
> > >Sent: Wednesday, August 29, 2001 3:00 PM
> > >Subject: [javascript] Several actions on a submit button
> > >
> > >
> > > > Hi Everyone!
> > > >
> > > > I'm trying to do several action on a submit button.
> > > > I want to send an email and then pass some values to another page.
> > > > I tried doing with a timer but it didn't pass the values I needed.
> > > > I need to perfomr the following actions
> > > >
> > > > a mailto
> > > > action=POST (upon a determined form)
> > > >
> > > > Please if anybody could help me I would really appreciate it
> > > >
> > > > Thank You
> > > >
> > > > Best Regards
> > > >
> > > > Kahine


  Return to Index