473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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


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
15 28910
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
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
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
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
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
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
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
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
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
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
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
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
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
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
your guys sucks, even argu for this kind of stuff.

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Fred Phase | last post by:
The following button definition works fine in Mozilla where the value "in" is assigned to "awol_status". In Internet Explorer 6.0.2800.1106 on Win 2K the value "switch status" is assigned to...
3
by: phil_gg04 | last post by:
Dear All, I am trying to influence the font size for a <button> element using CSS, but failing for IE. Works ok in FF. IE seems to ignore all attempts; for example with this: div.whatever...
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
2
by: Christopher Benson-Manica | last post by:
According to http://www.w3schools.com/tags/tag_button.asp, the type attribute of the <button> tag is optional. Is the UA at liberty to choose any type it wishes if the attribute is omitted? Does...
2
by: Steve Wilkinson | last post by:
I've just started using managed C++ with VS2005, so please forgive my ignorance. I'm investigating producing a managed wrapper for some functionality of the Windows Media Format SDK. I have the...
8
by: Rainer Queck | last post by:
Hi NG, I have a base class "Telegram". This class , as well as all descants have a static public field "public static int TelegramNo = <a tlg no>;" Now I added all descants of Telegram to a...
1
by: =?Utf-8?B?RnJhbmNvaXNWaWxqb2Vu?= | last post by:
Hi there, Does anybody know how to return the results of an IEnumerable<typeas an array of the same type i.e type in a web service call without first having to collect all elements in the...
2
by: Richard Maher | last post by:
Hi, I'm trying to use the Visibility Style attribute for a Div to effectively PopUp a lightweight window with some additional context-sensitive information, when a user mouses over a given...
1
by: lovecreatesbea... | last post by:
In the following function `HardwareStatusDb()', If its arguments are declared as type of `string', I get: main.cpp:5: error: expected initializer before ‘int’. The error disappears when those...
5
by: Ronald S. Cook | last post by:
From my business tier (class) I get back an IQueryable<Penof data. Here is my client code that works fine: PenClass penClass = new PenClass(); IQueryable<Penpens = penClass.SelectPens(); ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.