myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ali I Cheaito (JIRA)" <>
Subject [jira] [Created] (MYFACES-3836) f:ajax disabled=false in commandButton with onclick prevents form submission
Date Thu, 19 Dec 2013 18:16:09 GMT
Ali I Cheaito created MYFACES-3836:

             Summary: f:ajax disabled=false in commandButton with onclick prevents form submission
                 Key: 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
            Reporter: Ali I 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

	   <h:commandButton id="button1" value="AjaxTest" action="index" onclick="alert('test')">
	       <f:ajax disabled="true"  />

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

View raw message