You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Xu, Yiwen" <Yi...@intrado.com> on 2008/04/21 22:48:43 UTC

Question about cocoon vs. IE setting

We are currently experiencing a problem for button submission for IE
browser. We tested it in several IE. it worked successfully in
successfully, but some other IE seems unable to get the submitted button
id which cause our application failure (see below for more details). All
IE we originally tested was version 6. We upgrade those problematic IE
to 7 and 8.1, but same problem still occurred. Can anyone tell me what
IE configuration or OS configuration might impact this cocoon button
submission process?
 
Thanks in advance !!!
 
----- Details ----------
This is the html code which contains the "Summit" button.
<button title="" value="1" name="msag-query-QueryAction"
id="msag-query-QueryAction" type="submit" class="submit">Submit</button>
 
This is the debug message in the javascript program which loads and
processes the form:
    cocoon.log.error("submitted button ID : " + form.submitId + "\n
submitted widget :" + form.getWidget().getSubmitWidget());
 
For those IE which doesn't have problem, the debug result shows:
    submitted button ID : msag-query-QueryAction  submitted widget
:Submit-msag-query-QueryAction

 

But for those problematic IE, the debug result is:

    submitted button ID : undefined  submitted widget
:Submit-msag-query-QueryAction

which caused cocoon throws  " java.lang.IllegalStateException:
SubmitWidget can only be set once. "
 

Re: Question about cocoon vs. IE setting

Posted by Jeroen Reijn <j....@onehippo.com>.
Hi,

what happens if you use <input type="submit"/> instead of <button 
type="submit"? /> I'm not really sure why out shoud not work, but I have 
used <input type="submit"/> for years and it has never let me down :-)

Regards,

Jeroen Reijn

Xu, Yiwen wrote:
> We are currently experiencing a problem for button submission for IE 
> browser. We tested it in several IE. it worked successfully in 
> successfully, but some other IE seems unable to get the submitted button 
> id which cause our application failure (see below for more details). All 
> IE we originally tested was version 6. We upgrade those problematic IE 
> to 7 and 8.1, but same problem still occurred. Can anyone tell me what 
> IE configuration or OS configuration might impact this cocoon button 
> submission process?
>  
> Thanks in advance !!!
>  
> ----- Details ----------
> This is the html code which contains the "Summit" button.
> <button title="" value="1" name="msag-query-QueryAction" 
> id="msag-query-QueryAction" type="submit" class="submit">Submit</button>
>  
> This is the debug message in the javascript program which loads and 
> processes the form:
>     cocoon.log.error("submitted button ID : " + form.submitId + "\n 
> submitted widget :" + form.getWidget().getSubmitWidget());
>  
> For those IE which doesn't have problem, the debug result shows:
> 
>     submitted button ID : msag-query-QueryAction  submitted widget 
> :Submit-msag-query-QueryAction
> 
>  
> 
> But for those problematic IE, the debug result is:
> 
>     submitted button ID : undefined 
> 
> submitted widget :Submit-msag-query-QueryAction
> 
> which caused cocoon throws  " java.lang.IllegalStateException: 
> SubmitWidget can only be set once. "
>  


Re: Question about cocoon vs. IE setting

Posted by Jason Johnston <jj...@apache.org>.
Hi Yiwen, good to talk to you again!

(For future reference, user questions like this are better suited for 
the users@cocoon.apache.org mailing list.)

The bug you're encountering is not a Cocoon-specific issue, but rather a 
problem with how IE handles <button/> elements.  If you have multiple 
buttons on a page, IE will submit the name=value parameters for *all* of 
them, not just the one you clicked.  This is obviously a problem when 
your server-side code expects just name=value pair.

The "safe" solution is, as Jeroen suggested, to use <input 
type="submit"/> instead of <button/>, and that is in fact what is 
created by the default CForms styling XSLT.  However, there are 
advantages to <button/>, namely that it can display complex content as 
its label whereas <input/> can only display a simple text label.

Now, since I happen to have inside knowledge of the project you're 
working on ;-), I do know that displaying complex labels is required, so 
using <input/> isn't really an option.  That's why your product's custom 
CForms styling XSLT overrides the default template to create <button/>s 
instead.  To get around the IE bug, there is a client-side script that 
listens for button clicks, and performs some DOM manipulation to 
obfuscate the names of the non-clicked buttons so that they don't send 
clashing request parameters.  It sounds to me like this client-side 
script has somehow been broken, or is not working properly under a 
specific circumstance.

I hope that helps; if not, feel free to email me directly since there's 
no reason to bug the fine folks on this list with non-Cocoon discussions.

--Jason



Xu, Yiwen wrote:
> We are currently experiencing a problem for button submission for IE 
> browser. We tested it in several IE. it worked successfully in 
> successfully, but some other IE seems unable to get the submitted button 
> id which cause our application failure (see below for more details). All 
> IE we originally tested was version 6. We upgrade those problematic IE 
> to 7 and 8.1, but same problem still occurred. Can anyone tell me what 
> IE configuration or OS configuration might impact this cocoon button 
> submission process?
>  
> Thanks in advance !!!
>  
> ----- Details ----------
> This is the html code which contains the "Summit" button.
> <button title="" value="1" name="msag-query-QueryAction" 
> id="msag-query-QueryAction" type="submit" class="submit">Submit</button>
>  
> This is the debug message in the javascript program which loads and 
> processes the form:
>     cocoon.log.error("submitted button ID : " + form.submitId + "\n 
> submitted widget :" + form.getWidget().getSubmitWidget());
>  
> For those IE which doesn't have problem, the debug result shows:
> 
>     submitted button ID : msag-query-QueryAction  submitted widget 
> :Submit-msag-query-QueryAction
> 
>  
> 
> But for those problematic IE, the debug result is:
> 
>     submitted button ID : undefined 
> 
> submitted widget :Submit-msag-query-QueryAction
> 
> which caused cocoon throws  " java.lang.IllegalStateException: 
> SubmitWidget can only be set once. "
>