Submit form in IE doesn't send the correct event

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Submit form in IE doesn't send the correct event

alfatek
Hi,

I have a form that has 2 submit buttons (one to one event, another
goes to another).

Everything works alright except when I press enter to submit the form in IE7.

If I do that the button name isn't posted so Stripes goes to the
default handler instead of the correct event.


This also happens if I have only 1 submit button. My form has 1 select
and 2 input fields. I did the exact samething for other forms and they
work correctly, I don't understand why IE7 doesn't send this
information sometimes.


Anyone has a clue?

TIA

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

Re: Submit form in IE doesn't send the correct event

John W Newman
Sorry I can't really answer your question, but we gave up on submit button names a while ago.  Nice idea but it is a bit messy due to browser quirks, form serialization for ajax, and enter key submit.  Two submit's on the same page should work, but IIRC IE 6 and 7 do different things depending on number and types of fields on the form.  When we noticed this, I mocked up some test html pages, a lot of these combinations behaved differently and the submit name was deemed 'too unreliable' between gecko and ie6/7:  

One text field
One text field one submit
Two text fields one submit
Two text fields two submits
One select field one submit
Etc

Instead of even bothering to understand all these quirky 'rules' we opted to just to manage the _eventName parameter in any requests.  I'm curious if anyone has NOT run into issues with the default handler firing unexpectedly despite use of <stripes:submit name="notdefault" />.

The source of the event name has always caused a bit of confusion for me - the backend code around this was cleaned up recently, but IMO this,

     * <p>
     * Failing that, search for a parameter in the request whose name matches one of the named
     * events handled by the ActionBean. For example, if the ActionBean can handle events foo and
     * bar, this method will scan the request for foo=somevalue and bar=somevalue. If it finds a
     * request parameter with a matching name it will return that name. If there are multiple
     * matching names, the result of this method cannot be guaranteed and a
     * {@link StripesRuntimeException} will be thrown.
     * </p>

should not exist anymore..

Don't forget about the enter key =)  also prototype.js needed a patch to get submits into form.serialize()...  


-----Original Message-----
From: Paulo Silva [mailto:[hidden email]]
Sent: Wednesday, April 08, 2009 1:18 PM
To: [hidden email]
Subject: [Stripes-dev] Submit form in IE doesn't send the correct event

Hi,

I have a form that has 2 submit buttons (one to one event, another
goes to another).

Everything works alright except when I press enter to submit the form in IE7.

If I do that the button name isn't posted so Stripes goes to the
default handler instead of the correct event.


This also happens if I have only 1 submit button. My form has 1 select
and 2 input fields. I did the exact samething for other forms and they
work correctly, I don't understand why IE7 doesn't send this
information sometimes.


Anyone has a clue?

TIA

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

Re: Submit form in IE doesn't send the correct event

alfatek
Thanks John,

For the record also please note that I'm also trying this in some test
html pages (posting to php to print the post variables) and with only
1 submit button the problem exists... I have 2 forms where in one IE7
posts the button and another where it doesn't post, this is just
mad...

I can't use _eventName because my form has 2 submit buttons that go to
different events... So... what are my alternatives?

TIA


On Wed, Apr 8, 2009 at 6:44 PM, Newman, John W <[hidden email]> wrote:

> Sorry I can't really answer your question, but we gave up on submit button names a while ago.  Nice idea but it is a bit messy due to browser quirks, form serialization for ajax, and enter key submit.  Two submit's on the same page should work, but IIRC IE 6 and 7 do different things depending on number and types of fields on the form.  When we noticed this, I mocked up some test html pages, a lot of these combinations behaved differently and the submit name was deemed 'too unreliable' between gecko and ie6/7:
>
> One text field
> One text field one submit
> Two text fields one submit
> Two text fields two submits
> One select field one submit
> Etc
>
> Instead of even bothering to understand all these quirky 'rules' we opted to just to manage the _eventName parameter in any requests.  I'm curious if anyone has NOT run into issues with the default handler firing unexpectedly despite use of <stripes:submit name="notdefault" />.
>
> The source of the event name has always caused a bit of confusion for me - the backend code around this was cleaned up recently, but IMO this,
>
>     * <p>
>     * Failing that, search for a parameter in the request whose name matches one of the named
>     * events handled by the ActionBean. For example, if the ActionBean can handle events foo and
>     * bar, this method will scan the request for foo=somevalue and bar=somevalue. If it finds a
>     * request parameter with a matching name it will return that name. If there are multiple
>     * matching names, the result of this method cannot be guaranteed and a
>     * {@link StripesRuntimeException} will be thrown.
>     * </p>
>
> should not exist anymore..
>
> Don't forget about the enter key =)  also prototype.js needed a patch to get submits into form.serialize()...
>
>
> -----Original Message-----
> From: Paulo Silva [mailto:[hidden email]]
> Sent: Wednesday, April 08, 2009 1:18 PM
> To: [hidden email]
> Subject: [Stripes-dev] Submit form in IE doesn't send the correct event
>
> Hi,
>
> I have a form that has 2 submit buttons (one to one event, another
> goes to another).
>
> Everything works alright except when I press enter to submit the form in IE7.
>
> If I do that the button name isn't posted so Stripes goes to the
> default handler instead of the correct event.
>
>
> This also happens if I have only 1 submit button. My form has 1 select
> and 2 input fields. I did the exact samething for other forms and they
> work correctly, I don't understand why IE7 doesn't send this
> information sometimes.
>
>
> Anyone has a clue?
>
> TIA
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Stripes-development mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-development
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Stripes-development mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/stripes-development
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

Re: Submit form in IE doesn't send the correct event

Ben Gunter
In reply to this post by John W Newman
On Wed, Apr 8, 2009 at 1:44 PM, Newman, John W <[hidden email]> wrote:
The source of the event name has always caused a bit of confusion for me - the backend code around this was cleaned up recently, but IMO this,

    * <p>
    * Failing that, search for a parameter in the request whose name matches one of the named
    * events handled by the ActionBean. For example, if the ActionBean can handle events foo and
    * bar, this method will scan the request for foo=somevalue and bar=somevalue. If it finds a
    * request parameter with a matching name it will return that name. If there are multiple
    * matching names, the result of this method cannot be guaranteed and a
    * {@link StripesRuntimeException} will be thrown.
    * </p>

should not exist anymore..
 
That's just a case of comments not keeping up with code changes. As of Stripes 1.5, the _eventName parameter overrides everything else, even if there otherwise would be multiple events indicated.

Don't forget about the enter key =)  also prototype.js needed a patch to get submits into form.serialize()...


As of Prototype 1.6 (maybe 1.5?), you can specify in your Ajax.Updater or Ajax.Request options { submit: "theEventName" } to specify which submit button to include when serializing the form.

-Ben

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

Re: Submit form in IE doesn't send the correct event

alfatek
In reply to this post by alfatek
The behaviour in IE looks consistent:

Your form NEEDS to have at least 2 input of type "text" for IE to send
the submit button information...

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development
Reply | Threaded
Open this post in threaded view
|

Re: Submit form in IE doesn't send the correct event

John W Newman
In reply to this post by Ben Gunter

That's just a case of comments not keeping up with code changes. As of Stripes 1.5, the _eventName parameter overrides everything else, even if there otherwise would be multiple events indicated.”


yes this has been a good change.  I didn’t read that comment in detail, what I was really lobbying for there was to get rid of the whole request param/submit name thing and just use _eventName.  I understand most will not go for this, but it could maybe fall in line with best practice.   Or eliminate _eventName and force us to learn the all the browser rules and pass params accordingly.  

 

“As of Prototype 1.6 (maybe 1.5?), you can specify in your Ajax.Updater or Ajax.Request options { submit: "theEventName" } to specify which submit button to include when serializing the form.”

 

Yeah 1.6 added this and also form.serialize(true) to include submits.  But it’s still somewhat worse than _eventName: “theEventName” since theEventName is _guaranteed_ to run with that way.  I could still sneak  _eventName or a 2nd submit into the first version and throw it off.  IMO since _eventName has become the authoritative source why bother with anything else?   

 

 

“So... what are my alternatives?”

 

<a href=”’ onclick=”add(); return false;”>Add</a>

<script>

function add()  {

   $(‘_eventName’) = ‘add’;

  $(‘form’).submit();

}

 

“Your form NEEDS to have at least 2 input of type "text" for IE to send the submit button information...”

 

Yep, if you have 1 text field it will allow you to submit with enter.  You can write some javascript to catch key code 13 and return false, but any user is naturally going to hit enter to submit that form..

 

 

 

 

From: Ben Gunter [mailto:[hidden email]]
Sent: Wednesday, April 08, 2009 2:12 PM
To: Stripes Development List
Subject: Re: [Stripes-dev] Submit form in IE doesn't send the correct event

 

On Wed, Apr 8, 2009 at 1:44 PM, Newman, John W <[hidden email]> wrote:

The source of the event name has always caused a bit of confusion for me - the backend code around this was cleaned up recently, but IMO this,

    * <p>
    * Failing that, search for a parameter in the request whose name matches one of the named
    * events handled by the ActionBean. For example, if the ActionBean can handle events foo and
    * bar, this method will scan the request for foo=somevalue and bar=somevalue. If it finds a
    * request parameter with a matching name it will return that name. If there are multiple
    * matching names, the result of this method cannot be guaranteed and a
    * {@link StripesRuntimeException} will be thrown.
    * </p>

should not exist anymore..

 

Don't forget about the enter key =)  also prototype.js needed a patch to get submits into form.serialize()...

 


As of Prototype 1.6 (maybe 1.5?), you can specify in your Ajax.Updater or Ajax.Request options { submit: "theEventName" } to specify which submit button to include when serializing the form.

-Ben


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Stripes-development mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-development