Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > submit form data approaches

Reply
Thread Tools

submit form data approaches

 
 
Matt
Guest
Posts: n/a
 
      06-26-2004
I tried to figure out how many approaches to submit form data. Here's my
attempts.
Please advise. Thanks!!

1) html submit button, most commonly used.

<form name="formName" action="url" method="post">
<input type="submit">

2) html regular button, and a JavaScript to invoke the form.submit() method

<form action="url"
function submitForm()
{ //etc...
formName.submit();
}
<input type="button" onClick="submitForm()">

3) onsubmit event handling
<form name="formName" action="url" method="post" onsubmit="return
submitForm()">
function submitForm()
{ //etc...
//formName.submit(); //NOT NECESSARY!!
}
<input type="submit">
 
Reply With Quote
 
 
 
 
Jeff Thies
Guest
Posts: n/a
 
      06-26-2004

"Matt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I tried to figure out how many approaches to submit form data.


Or, none of the below.

Typically this is done with three submit buttons, each with the same name
but a different value.

Have your server script parse which button was used by looking at the
value, and then send the data on it's way.

If you must use javascript, then do something like this

<form onsubmit="changeAction()">....

function changeAction(){
var form=document.forms[0];

if(form['submit_name'].value == 'action1'){
form.action='some_server_script...

You may have to adjust that as I'm not sure if javascript will read the
pushed submit value without some help.

Jeff





>Here's my
> attempts.
> Please advise. Thanks!!
>
> 1) html submit button, most commonly used.
>
> <form name="formName" action="url" method="post">
> <input type="submit">
>
> 2) html regular button, and a JavaScript to invoke the form.submit()

method
>
> <form action="url"
> function submitForm()
> { file://etc...
> formName.submit();
> }
> <input type="button" onClick="submitForm()">
>
> 3) onsubmit event handling
> <form name="formName" action="url" method="post" onsubmit="return
> submitForm()">
> function submitForm()
> { file://etc...
> file://formName.submit(); file://NOT NECESSARY!!
> }
> <input type="submit">



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit abansal.itp@gmail.com Javascript 3 06-23-2007 07:29 AM
submit the form data to the popup window without a submit button jrefactors@hotmail.com Javascript 2 01-01-2005 06:07 AM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Submit Form Data Approaches Matt ASP General 2 06-27-2004 11:41 AM
submit form data approaches Matt Javascript 0 06-26-2004 08:05 PM



Advertisments