You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Ali Cheaito (JIRA)" <de...@myfaces.apache.org> on 2013/12/26 18:07:50 UTC

[jira] [Updated] (MYFACES-3836) f:ajax disabled=false in commandButton with onclick prevents form submission

     [ https://issues.apache.org/jira/browse/MYFACES-3836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ali Cheaito updated MYFACES-3836:
---------------------------------

    Status: Patch Available  (was: Open)

> f:ajax disabled=false in commandButton with onclick prevents form submission
> ----------------------------------------------------------------------------
>
>                 Key: MYFACES-3836
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3836
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.2.0-beta
>         Environment: MyFaces 2.2.0-beta, WildFly 8.0.0.Beta1, Jdk 1.7.0_25, Chrome 30.0.1599.101 m
>            Reporter: Ali Cheaito
>
> For <f:ajax> with disabled=true inside of a <h:commandButton> with an onclick function, MyFaces renders return=false after an unnecessary jsf.util.chain() call in the rendered <input> onclick, effectively preventing form submission. Consider the following simple commandButton
> 	   <h:commandButton id="button1" value="AjaxTest" action="index" onclick="alert('test')">
> 	       <f:ajax disabled="true"  />
> 	   </h:commandButton>	
> This will render as follows:
>     <input id="form1:button1" name="form1:button1" type="submit" value="AjaxTest" onclick="jsf.util.chain(document.getElementById('form1:button1'), event,'alert(\'test\');'); return false;">
> Clicking the button will neither trigger an ajax request, which it shouldn't, nor trigger a form submit, which it should. 
> Removing the <f:ajax> tag entirely renders the following functional submit button:
>     <input id="form1:button1" name="form1:button1" type="submit" value="AjaxTest" onclick="var cf = function(){alert('test')};var oamSF = function(){};return (cf.apply(this, [])==false)? false : oamSF.apply(this, []); ">



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)