[
https://issues.apache.org/jira/browse/MYFACES-3836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13861084#comment-13861084
]
Ali Cheaito commented on MYFACES-3836:
--------------------------------------
Thank you for taking the time to review.
> 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
> Assignee: Leonardo Uribe
> Fix For: 2.0.20, 2.1.14, 2.2.0
>
> Attachments: MYFACES-3836.patch
>
>
> 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)