Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Submit form with link

Reply
Thread Tools

Submit form with link

 
 
Terence Parker
Guest
Posts: n/a
 
      01-14-2004
Hello,

I wish to submit a form with a link instead of a submit button - but there's
a catch : using the same form, I want to have different links that submit
that form to different locations. Here's a simplification of what I have so
far:

<form name="SubmitUsers" method="POST" action="process.php">
<input type="checkbox" name="username[]" value="Some value">
<input type="checkbox" ........... >
</form>

<a href="javascript: void(0);" onclick="document.SubmitUsers.submit();return
false;">

- this link above will submit the form, but it will submit the form to
"process.php" as defined in the initial <form> clause. What if I want
another link that, say, submits to "process2.php" instead? But I want to be
able to use the same checkboxes, so I don't want to have to redefine another
form for this.

Can this be done?

Thanks!

Terence


 
Reply With Quote
 
 
 
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      01-14-2004
Quoth the raven named Terence Parker:

> I wish to submit a form with a link instead of a submit button -
> but there's a catch : using the same form, I want to have different
> links that submit that form to different locations. Here's a
> simplification of what I have so far:
>
> <form name="SubmitUsers" method="POST" action="process.php"> <input
> type="checkbox" name="username[]" value="Some value"> <input
> type="checkbox" ........... > </form>
>
> <a href="javascript: void(0);"
> onclick="document.SubmitUsers.submit();return false;">
>
> - this link above will submit the form, but it will submit the form
> to "process.php" as defined in the initial <form> clause. What if I
> want another link that, say, submits to "process2.php" instead? But
> I want to be able to use the same checkboxes, so I don't want to
> have to redefine another form for this.
>
> Can this be done?


Based on your description, I would add a radio button above the one
submit button, and have your process.php do what it does based on
which radio button was ticked.

Be sure to have none ticked by default.

--
-bts
-This space intentionally left blank.
 
Reply With Quote
 
 
 
 
Ryan Stewart
Guest
Posts: n/a
 
      01-14-2004
"Terence Parker" <(E-Mail Removed)> wrote in message
news:bu3u1l$(E-Mail Removed)...
> Hello,
>
> I wish to submit a form with a link instead of a submit button - but

there's
> a catch : using the same form, I want to have different links that submit
> that form to different locations. Here's a simplification of what I have

so
> far:
>
> <form name="SubmitUsers" method="POST" action="process.php">
> <input type="checkbox" name="username[]" value="Some value">
> <input type="checkbox" ........... >
> </form>
>
> <a href="javascript: void(0);"

onclick="document.SubmitUsers.submit();return
> false;">
>
> - this link above will submit the form, but it will submit the form to
> "process.php" as defined in the initial <form> clause. What if I want
> another link that, say, submits to "process2.php" instead? But I want to

be
> able to use the same checkboxes, so I don't want to have to redefine

another
> form for this.
>
> Can this be done?
>
> Thanks!
>
> Terence


I may be wrong, but can't you change the form's action? Something like:
document.SubmitUsers.action="process2.php";

That's just a wild guess, so you'll have to do some research, but I think
it's possible.


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      01-14-2004
in post: <news:bu3u1l$(E-Mail Removed)>
"Terence Parker" <(E-Mail Removed)> said:

> I wish to submit a form with a link instead of a submit button


not a good idea.

> - but there's a catch : using the same form, I want to have different
> links that submit that form to different locations.


use two submit buttons, script redirects based on submit button pressed.

> <a href="javascript: void(0);" onclick="document.SubmitUsers.submit();return
> false;">


that not going to do anything for people without JS


--
brucie
 
Reply With Quote
 
Ryan Stewart
Guest
Posts: n/a
 
      01-14-2004
"brucie" <****@bruciesusenetshit.info> wrote in message
news:bu4ekn$djj83$(E-Mail Removed)-berlin.de...
> in post: <news:bu3u1l$(E-Mail Removed)>
> "Terence Parker" <(E-Mail Removed)> said:
>
> > I wish to submit a form with a link instead of a submit button

>
> not a good idea.
>
> > - but there's a catch : using the same form, I want to have different
> > links that submit that form to different locations.

>
> use two submit buttons, script redirects based on submit button pressed.
>
> > <a href="javascript: void(0);"

onclick="document.SubmitUsers.submit();return
> > false;">

>
> that not going to do anything for people without JS
>
>
> --
> brucie


Well, some people think buttons are ugly and program for the vast majority
of people who have scripting enabled. And some people are assured of a user
base with scripting enabled.


 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      01-15-2004
in post: <news:(E-Mail Removed)>
"Ryan Stewart" <(E-Mail Removed)> said:

>>> <a href="javascript: void(0);" onclick="document.SubmitUsers.submit()
>>> ;return false;">


>> that not going to do anything for people without JS


> Well, some people think buttons are ugly


use css to style the button to look like a text link, its simple. (i
don't recommended it). scripting support not required.

> and program for the vast majority of people who have scripting
> enabled.


you're an idiot. it simply doesn't make sense to implement a solution
that will break for some people when there is a solution that will work
for everyone.

--
brucie - i usenet nude
 
Reply With Quote
 
Mark Parnell
Guest
Posts: n/a
 
      01-15-2004
On Wed, 14 Jan 2004 16:58:30 -0600, Ryan Stewart "Ryan Stewart"
<(E-Mail Removed)> declared in alt.html:
> "brucie" <****@bruciesusenetshit.info> wrote in message
> news:bu4ekn$djj83$(E-Mail Removed)-berlin.de...
>> in post: <news:bu3u1l$(E-Mail Removed)>
>> "Terence Parker" <(E-Mail Removed)> said:
>>
>>> I wish to submit a form with a link instead of a submit button

>>
>> not a good idea.
>>
>>> <a href="javascript: void(0);"

> onclick="document.SubmitUsers.submit();return
>>> false;">

>>
>> that not going to do anything for people without JS

>
> Well, some people think buttons are ugly


Whether they are ugly or not, at least your users know what they are.

> and program for the vast majority of people who have scripting enabled.


Majority, yes. Vast majority? That's debatable. Most estimates say that
around 15% (that's 1 in 20) of your site's visitors will have scripting
disabled. That's a pretty significant portion, IMHO.

And why do something that requires client-side scripting when it can be
done just as easily without needing client-side scripting?

> And some people are assured of a user base with scripting enabled.


Then they specify that in their original post. The OP did not, so as per
the FAQ, we assume they are talking in a www context.

--
Mark Parnell
http://www.clarkecomputers.com.au
 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      01-15-2004
in post: <news:(E-Mail Removed)>
"Ryan Stewart" <(E-Mail Removed)> said:

>>> <a href="javascript: void(0);" onclick="document.SubmitUsers.submit()
>>> ;return false;">


>> that not going to do anything for people without JS


> Well, some people think buttons are ugly


perhaps you could identify for me which is the text link that requires
JS to work and which is the submit button that doesn't need anything to
work in this image:

http://moreshit.bruciesusenetshit.info/submit01.png [1k]


--
brucie - i usenet nude
 
Reply With Quote
 
Ryan Stewart
Guest
Posts: n/a
 
      01-15-2004
"brucie" <****@bruciesusenetshit.info> wrote in message
news:bu4so5$dt9m0$(E-Mail Removed)-berlin.de...
> in post: <news:(E-Mail Removed)>
> "Ryan Stewart" <(E-Mail Removed)> said:
>
> >>> <a href="javascript: void(0);" onclick="document.SubmitUsers.submit()
> >>> ;return false;">

>
> >> that not going to do anything for people without JS

>
> > Well, some people think buttons are ugly

>
> perhaps you could identify for me which is the text link that requires
> JS to work and which is the submit button that doesn't need anything to
> work in this image:
>
> http://moreshit.bruciesusenetshit.info/submit01.png [1k]


The top one is the button.

Sorry, I've gotta get used to the fact that this NG doesn't tell people what
they ask, but what they should do instead. I agree that a button is a better
solution to his problem. I also think you could be less inflammatory about
such things, as you are a good source of information in this group, but
c'est la vie.


 
Reply With Quote
 
rf
Guest
Posts: n/a
 
      01-15-2004

"Ryan Stewart" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "brucie" <****@bruciesusenetshit.info> wrote in message
> news:bu4ekn$djj83$(E-Mail Removed)-berlin.de...
> > in post: <news:bu3u1l$(E-Mail Removed)>
> > "Terence Parker" <(E-Mail Removed)> said:
> >

> Well, some people think buttons are ugly


The "vast majority" of viewers think that buttons are just fine. They are
used to them and used to clicking on them.

Make a button look like something else and they will probably not click on
it and declare the site broken.

This is how a standard gui works. It contains, amongst other things,
familiar buttons.

Cheers
Richard.


 
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
Convert form to submit on load instead of clicking submit button? Network-Man HTML 5 07-07-2012 12:06 PM
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
Forms with multiple submit buttons vs 'form' objects with single 'submit' methods neil.fitzgerald@ic.ac.uk Python 4 04-14-2006 04:58 PM
submit the form data to the popup window without a submit button jrefactors@hotmail.com HTML 2 01-01-2005 06:07 AM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM



Advertisments