By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,190 Members | 2,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,190 IT Pros & Developers. It's quick & easy.

<button type=submit...> and <input type=submit ...>

P: n/a

Hi!
I have a <form> that can be submitted thruogh three buttons and I need
to tell witch one was pressed when the form was submitted. I now do it
with 3 <input type="submit" name="..." value="...">

with <input type="submit" ...> the only name-value values submitted
(pushed into the query string) is the one of the submit button that was
pushed (if you have many of them).

Ex:
<form ...>
<input type="text" .../>
<input type="submit" name="a" value="click".../>
<input type="submit" name="b" value="click2".../>
<input type="submit" name="c" value="click3".../>
</form>

in a form like this I can easily distinguish what button was used to
submit the form AFTER SUBMITTING.
but with <button type="submit" name="..." .... > click! </button> all
the name-innertext values are submitted (pushed to the query string)

Ex:
<form ...>
<input type="text" .../>
<button type="submit" name="a"> click </button>
<button type="submit" name="b"> click2 </button>
<button type="submit" name="c"> click3 </button>
</form>

What ways do I have to distinguish what button was used to submit the
form AFTER SUBMITTING?

Is there a way to do it without using javascript?
--
Mattia <ma******@libero.it>
http://www.chiacchierando.com/

Jul 20 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a
Mattia <ma******@libero.it> wrote:
I have a <form> that can be submitted thruogh three buttons and I need
to tell witch one was pressed when the form was submitted. I now do it
with 3 <input type="submit" name="..." value="...">
Fine.
<input type="submit" name="a" value="click".../>
<input type="submit" name="b" value="click2".../>
<input type="submit" name="c" value="click3".../>
</form>

in a form like this I can easily distinguish what button was used to
submit the form AFTER SUBMITTING.
Yes indeed. You have made it double sure by using different name attributes
_and_ different value attributes. (Either of them would suffice.) The user
may have difficulties in understanding BEFORE SUBMITTING what click, click2,
and click3 mean. :-)
but with <button type="submit" name="..." .... > click! </button> all
the name-innertext values are submitted (pushed to the query string)
Browsers are known to misbehave in this area. The specifications aren't
absolutely crystal clear either - are such elements really "submit buttons"?
What ways do I have to distinguish what button was used to submit the
form AFTER SUBMITTING?

Is there a way to do it without using javascript?


Why do you postulate that javascript could help here?

Anyway, you describe that you now have a working solution. Just stick to it,
and don't create problems by switching to <button>. Simple as that.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2

P: n/a
On Mon, 10 Nov 2003 00:48:35 +0000 (UTC), in
comp.infosystems.www.authoring.html, Jukka K. Korpela wrote:
in a form like this I can easily distinguish what button was used to
submit the form AFTER SUBMITTING.
but with <button type="submit" name="..." .... > click! </button> all
the name-innertext values are submitted (pushed to the query string) Browsers are known to misbehave in this area. The specifications aren't
absolutely crystal clear either - are such elements really "submit buttons"?


I think they are and it's quite clear: just send a variable if clicked
What ways do I have to distinguish what button was used to submit the
form AFTER SUBMITTING?
Is there a way to do it without using javascript?

Why do you postulate that javascript could help here?


Because it does.
My same problem, on this same newsgroup:

http://tinylink.com/?CwT8jobe3S or
msg-id <sl*******************@choam.efrei.fr>

My php solution (msg in french, but php is still php):
I use javascript for IE and buttons for the others

http://groups.google.com/groups?selm...choam.efrei.fr
or msg-id <sl********************@choam.efrei.fr>
Anyway, you describe that you now have a working solution. Just stick to it,
and don't create problems by switching to <button>. Simple as that.


If you can, yes, that's even better :)

--
++++++++ Zelda, Dragon Ball, Mana and my (art)work at www.salagir.com ++++++++
Jul 20 '05 #3

P: n/a
Salagir <Sa*****@jeruCITEDELESPACE.org.invalid> wrote:
Browsers are known to misbehave in this area. The specifications
aren't absolutely crystal clear either - are such elements really
"submit buttons"?


I think they are and it's quite clear: just send a variable if clicked


No, that's certainly not true. There is no requirement that clicking would
be the only possibility of activating an element. You seem to have a rather
simplistic view on the situation - that's why it looks clear to you.
Why do you postulate that javascript could help here?


Because it does.


It cannot, of course. You are apparently not considering the issue within
the context of this group, which is HTML authoring for the _World Wide Web_.
Postulating that a particular client-side scripting language is supported by
the browser and enabled means that you are not thinking in WWW terms.
Anyway, you describe that you now have a working solution. Just stick
to it, and don't create problems by switching to <button>. Simple as
that.


If you can, yes, that's even better :)


Why would it be a matter of being able to do something? Exactly what would
be needed for continuing the use of a simple, robust solution, as opposite
to changing it to a <button> problem?

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #4

P: n/a
On Mon, 10 Nov 2003 11:19:10 +0000 (UTC), in
comp.infosystems.www.authoring.html, Jukka K. Korpela wrote:
Salagir <Sa*****@jeruCITEDELESPACE.org.invalid> wrote:
The specifications aren't absolutely crystal clear either I think they are and it's quite clear: just send a variable if clicked

No, that's certainly not true. There is no requirement that clicking would
be the only possibility of activating an element.


Of course, by saying "if clicked" I meant "if the form was submitted
using the specific button created by this tag" ;)
You seem to have a rather
simplistic view on the situation - that's why it looks clear to you.


Yes, but isn't html simple ? ;) That's why it works.
Why do you postulate that javascript could help here?

Because it does.

It cannot, of course. You are apparently not considering the issue within
the context of this group, which is HTML authoring for the _World Wide Web_.
Postulating that a particular client-side scripting language is supported by
the browser and enabled means that you are not thinking in WWW terms.


In what follows, I use javascript only with IE, considering that the
others browsers... respect w3c. And I don't consider IE users as people
bright enought to disable javascript. I they are, they're bright enought
to use a real browser.
If you can, yes, that's even better :)

Why would it be a matter of being able to do something? Exactly what would
be needed for continuing the use of a simple, robust solution, as opposite
to changing it to a <button> problem?


Well, I don't know exactly what he intends to do.

Plus, button can make nice things like puttings images and html text in
it.. and I think it's cool, sorry ;)

--
++++++++ Zelda, Dragon Ball, Mana and my (art)work at www.salagir.com ++++++++
Hi! Je voudrais une crÍpe au chocolat fruits de mer, s'il vous plait!
Jul 20 '05 #5

P: n/a
On Mon, 10 Nov 2003, Salagir wrote:
On Mon, 10 Nov 2003 00:48:35 +0000 (UTC), in
comp.infosystems.www.authoring.html, Jukka K. Korpela wrote:
Why do you postulate that javascript could help here?
Because it does.


You can't have been reading this group for long! In a WWW context,
it's a mistake to make Javascript a mandatory part of any solution.

Optional extras are a different matter, but that doesn't seem to be
what we have here.

My reaction to your posting was that you already had a competent
solution, and now seemed to be looking for a way to break it.
I use javascript for IE and buttons for the others


Not on my IE, you won't. When Billware alerts me with the ominous
alert message "Scripts are usually safe", I read that as "scripts are
sometimes disastrous - would I want to run scripts from a site that
has, as yet, given me no reason to trust it?".
Jul 20 '05 #6

P: n/a
On Mon, 10 Nov 2003 11:00:42 +0000, in comp.infosystems.www.authoring.html,
Alan J. Flavell wrote:
I use javascript for IE and buttons for the others

Not on my IE, you won't. When Billware alerts me with the ominous
alert message "Scripts are usually safe", I read that as "scripts are
sometimes disastrous - would I want to run scripts from a site that
has, as yet, given me no reason to trust it?".


Why do you use this "biggest spyware and security hole usable" for a
browser then ?
I enable javascript with firebird and was never bothered by any pop-up
and others. For some little details, javascript can be usefull, and if
there is a real problem, I disable javascript with one click.

(omg did I just begin a troll??)
--
++++++++ Zelda, Dragon Ball, Mana and my (art)work at www.salagir.com ++++++++
<\slick> 3d studio max install told me to close all program when
installing, so i just opened more to be defiant
<\slick> take that
Jul 20 '05 #7

P: n/a
On Mon, 10 Nov 2003, Salagir wrote:
On Mon, 10 Nov 2003 11:00:42 +0000, in comp.infosystems.www.authoring.html,
Alan J. Flavell wrote:
I use javascript for IE and buttons for the others Not on my IE, you won't. When Billware alerts me with the ominous
alert message "Scripts are usually safe", I read that as "scripts are
sometimes disastrous - would I want to run scripts from a site that
has, as yet, given me no reason to trust it?".


Why do you use this "biggest spyware and security hole usable" for a
browser then ?


OK: normally, I use Mozilla. Sometimes I need to use IE. I chose to
present the IE scenario since it's closer to what (statistically)
most users would be starting from. After all, this isn't supposed to
be about me, alone, personally, but about j.random.cautious.webnaut.
We don't, of course, know what security settings they choose, but
after a few trojan infections and OS re-installations they might start
to get some kind of message.

Both of those browsers have options to disable scripting. Indeed,
every browser has an option to disable scripting: just stick it behind
an appropriate proxy.
I enable javascript with firebird and was never bothered by any pop-up
Oh, I enabled those warnings quite deliberately by choice. I _want_
to be bothered when someone's trying to execute untrusted code on my
computer.
and others. For some little details, javascript can be usefull,


You seem to have overlooked the fact that this is an _authoring_
discussion group, and what's more, in a *WWW* context. You don't get
anywhere by arguing with users as to whether they are going to allow
you to execute your javascript on their computer. You do better to
adapt your authoring so that they get the substantive part of your
content.
Jul 20 '05 #8

P: n/a
thanks Salagir!
Well, I don't know exactly what he intends to do.


I will do what Salagir sugested to do!
The problem was: I had a working form with <input type="submit" ..> and
wanted to improve the look of it by substituting it with a <button> tag,
because in a <button> tag you can insert formatted text, images...

Salagir gave me a solution, Jukka gave me nothing.

Jukka, i know that rich text, images and javascript hurt your soul of
"pure HTML" programmer. I know you want everything to be plain text, but
that's now what I want, that's not what my customers want, that's not
what my boss wants. Maybe they're all stupid,
but this is the way the world goes.

Thank you for all the information.

--
Mattia <ma******@libero.it>
http://www.chiacchierando.com/

Jul 20 '05 #9

P: n/a
Mattia <ma******@libero.it> wrote:
Salagir gave me a solution, Jukka gave me nothing.
I cannot give you the right answer, if you are not willing to receive it.
(We note, en passant, that you don't post the URL of your purported solution
[i.e., a non-solution to a non-problem].)
Jukka, i know that rich text, images and javascript hurt your soul of
"pure HTML" programmer.


We are not on a first name basis, but thanks anyway for telling that you
don't even know what HTML is. Please do not stop using your current
malformed From field until you have something to say about HTML authoring
for the World Wide Web.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #10

P: n/a
Mattia wrote:

Jukka, i know that rich text, images and javascript hurt your soul of
"pure HTML" programmer. I know you want everything to be plain text,


Strawman argument. He said no such thing. Beside, as this is an html
authoring group, it'd be hard to advocate plain text documents without
going off-topic anyways.

--
Brian
follow the directions in my address to email me

Jul 20 '05 #11

P: n/a
Sometime around Tue, 11 Nov 2003 16:46:22 +0100, Mattia is reported to have
stated:
Jukka, i know that rich text, images and javascript hurt your soul of
"pure HTML" programmer. I know you want everything to be plain text,


http://ppewww.ph.gla.ac.uk/~flavell/www/html-smac.html

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #12

P: n/a
On Tue, 11 Nov 2003, Mattia wrote:
I will do what Salagir sugested to do!
Well, here's an interesting snippet of advice from Salagir:

|> Anyway, you describe that you now have a working solution. Just
|> stick to it, and don't create problems by switching to <button>.
|> Simple as that.
|
| If you can, yes, that's even better :)
The problem was: I had a working form with <input type="submit" ..> and
wanted to improve the look of it by substituting it with a <button> tag,
You're absolutely right: you had a working solution, and your problem
was that you wanted to get rid of it. So stop wanting that.
because in a <button> tag you can insert formatted text, images...
Nice idea. Just that browser support for that is worse than crap, in
many of the browsers used out there on the WWW.
Salagir gave me a solution,
Salagir seems to have given you more than one solution. And the
preferred one works, in a WWW context. No big surprises then that it
was also the one that you got from Jukka.
Jukka gave me nothing.
Wrong. You were just too thick to notice it. Strange that you didn't
criticise Salagir for offering you practically the same advice
(quoted above).
Jukka, i know that rich text, images and javascript hurt your soul of
"pure HTML" programmer. I know you want everything to be plain text,
Sturgeon's law proves itself again. QED.
what my boss wants.


Has your boss made a years-long study of engineering web pages for the
WWW? If not, then I know whose judgment I'd rather trust. Especially
when you show that you haven't even comprehended the context of what
Jukka was trying to tell you.

If I thought you were capable of working with it, I might mention
input type=image, but in the circumstances I think you're better off
staying with the submit button. Just possibly with some CSS
suggestions, as long as you keep in mind that they're only
suggestions.

Have fun.
Jul 20 '05 #13

P: n/a
On Mon, 10 Nov 2003 14:54:23 +0000, in comp.infosystems.www.authoring.html,
Alan J. Flavell wrote:
Both of those browsers have options to disable scripting.
Yes, they are certainly lots of users with IE and without JS, even if I
do hope they'd do another step and use a real browser. I admit.

But I will stand on my idea for certain cases. Javascript is usefull and
can be used for, by exemple:
- online applications
- page with very complicated forms, like biiiiig <select> you don't
want to load 5 times...
- a neat-cool animation/thingy that won't be missed if JS is disabled
and that's NOT anoying (which exclude the fucking things that follows
your cursor, the snow on the page, etc ;)
Indeed,
every browser has an option to disable scripting: just stick it behind
an appropriate proxy.


What ? How can a proxy have any action on local javascripts ?
I enable javascript with firebird and was never bothered by any pop-up

Oh, I enabled those warnings quite deliberately by choice. I _want_
to be bothered when someone's trying to execute untrusted code on my
computer.


Well, Firebird shows a little icon in the down-left corner :)

You speak about "untrusted code". What does it mean exactly ? I use (and
know how to use) JS only for html-related changes... What kind of
functions are you thinking about ?

and others. For some little details, javascript can be usefull,

You seem to have overlooked the fact that this is an _authoring_
discussion group, and what's more, in a *WWW* context. You don't get
anywhere by arguing with users as to whether they are going to allow
you to execute your javascript on their computer. You do better to
adapt your authoring so that they get the substantive part of your
content.


I'm sorry I'm not sure I understand all the paragraph. You mean that I
should never use JS at all?
....or that we're trolling in the wrong group?

--
++++++++ Zelda, Dragon Ball, Mana and my (art)work at www.salagir.com ++++++++
Jul 20 '05 #14

P: n/a
On Thu, 13 Nov 2003, Salagir wrote:
What ? How can a proxy have any action on local javascripts ?
What do you understand by "local javascripts"? Bookmarklets, maybe? A
very useful concept indeed, from a user's point of view, but not the
current topic.

What we're talking about here, in contrast, are javascripts sent by
the server as part of the current web page, and possibly executed by
the client. If a proxy (junkbuster, webwasher etc.) filters the
script parts out on the way, then there's nothing for the client to
execute. So this can be effective for any browser, as I said. Some
corporate sites enforce this for all users; some users install
personal proxies of this kind as a security precaution.
You speak about "untrusted code". What does it mean exactly ?
I thought it was self-explanatory, sorry.
I'm sorry I'm not sure I understand all the paragraph. You mean that I
should never use JS at all?


No, I don't mean that at all. I mean that you should design your use
of scripting - at least for the WWW context - to be optional, on the
understanding that some proportion of your readers either cannot or
will not consent to execute it.
Jul 20 '05 #15

P: n/a
your guys sucks, even argu for this kind of stuff.

P.S. I have freedom of speech.
Jul 25 '06 #16

This discussion thread is closed

Replies have been disabled for this discussion.