From: Bwig Zomberi on
Garrett Smith wrote:
> Thomas 'PointedEars' Lahn wrote:
>> Neil wrote:
>>
>>> <form onsubmit="return false;" action="[action]" method="post">
>>> <textarea name="myText" cols="30" rows="3"></textarea>
>>> <input type="button" name="button" value="Value2"
>>> onClick="this.form.submit();"/>
>>> <input type="button" name="button" value="Value2"
>>> onClick="this.form.submit();"/>
>>> </form>
>>>

>
> The reason for this can be explained.
>
> When a form is submitted, the browser must determine which button was
> activated (clicked) for the request.
>
> Your form prevents normal submission with :
> | <form onsubmit="return false;"
>
> .
>
> The INPUT button being clicked is a separate event.

Why do other form values get submitted If you replace the input fields
with the type text, their values get submitted. They do not get
submitted only if the type is button or submit. Does some spec recommend
this?


--
Bwig Zomberi
From: Thomas 'PointedEars' Lahn on
Garrett Smith wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Garrett Smith wrote:
>>> Eric Bednarz wrote:
>>>> Garrett Smith <dhtmlkitchen(a)gmail.com> writes:
>>>>>> Are you sure you want to use XHTML?
>>>>> Probably not; that small sample contains XHTML errors.
>>>> Please don't feel shy about being specific.
>>> Don't be scared to run the code through the w3c html validator and find
>>> them for yourself.
>>
>> You don't know what you are talking about. It's a fragment of Valid
>> XHTML 1.0 Transitional.
>
> That is an assumption. It could very well be XHTML strict for all you
> know.

I have written it to be XHTML 1.0 Transitional, stupid.

> Going with your assumption of XHTML transitional, there is still one
> error. Can't spot it? Error: There is no attribute "onClick".

There is no "onClick" in my suggestion, stupid.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: Thomas 'PointedEars' Lahn on
Gordon wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Garrett Smith wrote:
>> > Eric Bednarz wrote:
>> >> Garrett Smith <dhtmlkitc...(a)gmail.com> writes:
>> >>>> Are you sure you want to use XHTML?
>> >>> Probably not; that small sample contains XHTML errors.
>>
>> >> Please don't feel shy about being specific.
>>
>> > Don't be scared to run the code through the w3c html validator and find
>> > them for yourself.
>>
>> You don't know what you are talking about. It's a fragment of Valid
>> XHTML 1.0 Transitional.
^^^^^^^^^^^^^^^^^^^^^^
>> [...]
>
> Form controls can't be children of a form. They have to be contained
> in something else, a fieldset preferably, but a div will do.

Nonsense. Learn to read.


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
From: Thomas 'PointedEars' Lahn on
Garrett Smith wrote:

> Thomas 'PointedEars' Lahn wrote:
>> Garrett Smith wrote:
>>> Thomas 'PointedEars' Lahn wrote:
>>>> Neil wrote:
> [...]
>>>>> When I look at the posted values, I do not have a value for the
>>>>> button.
>>>>> How can I tell which of these buttons the user pressed?
>>>> By RTFM and not shooting yourself in the foot:
>>> Link?
>> Sense?
>
> The OP does not know how to do what he wants done and that responding
> with "RTFM" is going to come off as churlish and vague.
>
> Make sense?

And assuming that level of knowledge and intelligence, your posting makes a
whole lot more sense to them. NOT.

Why don't you FOAD?


PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
From: Thomas 'PointedEars' Lahn on
Neil wrote:

> [Thomas 'PointedEars' Lahn wrote:]
>> By RTFM and not shooting yourself in the foot:
>> <form action="..." method="post">
>> <textarea name="myText" cols="30" rows="3"></textarea>
>> <input type="submit" name="button" value="Value1" />
>> <input type="submit" name="button" value="Value2" />
>> </form>
>
> The problem is that I have text inputs on the form
> as well and the customer does not want the return key
> to submit the form.

That's a really bad idea. You should tell your customer that this would
create an accessibility problem, with the potential of resulting in a
lawsuit (IANAL), and loss of profit. Most importantly, it would probably
not be compliant with Section 508 of the U.S. Rehabilitation Act (which
could only be a violation if the customer would be or would be selling the
application to a Federal agency, but they might want to uphold high
standards nevertheless).

> If I use input type="submit", the form always gets posted with a return
> keypress.

No, if you kept your canceling `onsubmit' listener in place, that would not
happen. (Don't do that.)

But instead you can use a keyboard event listener to detect the Return
keypress when the input control has focus, and cancel the event then.

However, users without a pointing device and with script support will not be
able to submit the form other than through tab-focusing either submit button
and pressing Return or Space. Users with a keyboard and without script
support will always be able to submit the form using the Return key with
either text input or submit button having the focus.

Please leave one attribution line for each quotation level.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)