Javascript error on return of PPR when button is disabled during request
-------------------------------------------------------------------------
Key: TRINIDAD-752
URL: https://issues.apache.org/jira/browse/TRINIDAD-752
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Affects Versions: 1.0.2-core
Environment: Win XP SP2, Internet Explorer 6, JBoss 4.0.5, JDK 1.5.0_10
Reporter: Shawn Bertrand
If a particular PPR request originates from a commandButton and the
commandButton is disabled as a result of the PPR request, Trinidad's javascript
code will cause an error. This error happens because it tries to set focus to
that command button at the end of the PPR request but cannot because it is
disabled.
To reproduce the problem using the Trinidad demo:
1. If you are using the 1.0.1 demo, replace the 1.0.1 jars with 1.0.2 (or
1.0.3, which I didn't verify)
2. Add the disabled property for the following tag in /demos/pprDemos.jspx:
<tr:commandButton id="pSub_button"
disabled="#{partialDemoUtil.buttonDisabled}"
immediate="true"
partialSubmit="true"
text="partialSubmit Button"
actionListener="#{partialDemoUtil.action}"/>
3. Change the action method of
org.apache.myfaces.trinidaddemo.PartialUtilDemoBean.java to:
public class PartialDemoUtilBean
{
private boolean disabled = false;
public void action(ActionEvent action)
{
// Just update the string which says when the last update was.
_status.setLinkUpdate();
// Toggle enabled state
disabled = !disabled;
// Force button redraw
RequestContext.getCurrentInstance().addPartialTarget(action.getComponent());
}
public boolean isButtonDisabled()
{
return disabled;
}
.
.
.
4. Run the demo and click the "partialSubmit button". You'll notice the button
does go gray (expected) but the time doesn't update as it should and there is a
Javascript error ("Console is undefined"). The real error is "Can't move focus
to the control because it is invisible, not enabled, or of a type that does not
accept the focus."
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.