You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Guy Bashan <gu...@gmail.com> on 2008/04/24 22:46:54 UTC

More problems with "disabled" property of

Hi,

 

When I try to set using javascript the disabled property to true. I get this
weird server exception:

javax.faces.FacesException: Exception while setting value for expression :
#{cmp_delivery.selectedEndDateYear} of component with path : {Component-Path
: [Class: javax.faces.component.UIViewRoot,ViewId: /cmp_delivery.jsp][Class:
javax.faces.component.html.HtmlForm,Id: formCampaignDelivery][Class:
javax.faces.component.html.HtmlSelectOneMenu,Id: endDateYear]}

        at
javax.faces.component.UIInput.queueExceptionInRequest(UIInput.java:262)

        at javax.faces.component.UIInput.updateModel(UIInput.java:243)

        at javax.faces.component.UIInput.processUpdates(UIInput.java:167)

        at javax.faces.component.UIForm.processUpdates(UIForm.java:91)

        at
javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:72
9)

        at javax.faces.component.UIViewRoot.access$201(UIViewRoot.java:43)

        at javax.faces.component.UIViewRoot$3.process(UIViewRoot.java:109)

        at javax.faces.component.UIViewRoot.process(UIViewRoot.java:206)

        at
javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:105)

        at
org.apache.myfaces.lifecycle.UpdateModelValuesExecutor.execute(UpdateModelVa
luesExecutor.java:33)

        at
org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:1
03)

        at
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)

        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

        at
com.todacell.ui.view.filter.OpenSessionInViewFilter.doFilterInternal(OpenSes
sionInViewFilter.java:149)

        at
com.todacell.ui.view.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:61)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

        at
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.
java:147)

        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:235)

        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:233)

        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)

        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
)

        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
)

        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)

        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)

        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:584)

        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

        at java.lang.Thread.run(Thread.java:619)

Caused by: org.apache.jasper.el.JspELException: /cmp_delivery.jsp(130,48)
'#{cmp_delivery.selectedEndDateYear}' java.lang.IllegalArgumentException

        at
org.apache.jasper.el.JspValueExpression.setValue(JspValueExpression.java:94)

        at javax.faces.component.UIInput.updateModel(UIInput.java:230)

        ... 30 more

Caused by: java.lang.IllegalArgumentException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)

        at
javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)

        at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$501(F
acesCompositeELResolver.java:46)

        at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$6.invoke(Fac
esCompositeELResolver.java:132)

        at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(Faces
CompositeELResolver.java:148)

        at
org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(Fac
esCompositeELResolver.java:128)

        at org.apache.el.parser.AstValue.setValue(AstValue.java:114)

        at
org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)

        at
org.apache.jasper.el.JspValueExpression.setValue(JspValueExpression.java:85)

        ... 31 more

 

This is the javascript code, that simply sets the disabled to "true". When I
remark the disabled all is working fine (but not behaves as I would like):

  function disableEndDate()

  {

    var expire = document.getElementById('formCampaignDelivery:expire');

 

    if (expire != null)

    {

      var day = document.getElementById('formCampaignDelivery:endDateDay');

      var month =
document.getElementById('formCampaignDelivery:endDateMonth');

      var year =
document.getElementById('formCampaignDelivery:endDateYear');

      if (expire.checked)

      {

        day.selectedIndex = 0;

        day.disabled = true;

        month.selectedIndex = 0;

        month.disabled = true;

        year.selectedIndex = 0;

        year.disabled = true;

      }

      else

      {

        day.disabled = false;

        month.disabled = false;

        year.disabled = false;

      }

    }

  }

 


Re: More problems with "disabled" property of

Posted by Andrew Robinson <an...@gmail.com>.
A non-disabled, rendered component should have a submittedValue. By
hacking the client DOM you are kind of invalidating to contract of the
component.

I think a better method is to use PPR to change the disabled property
of the component & re-render the component. Renderers are not supposed
to have to handle external changes to the DOM they encode.

-Andrew

On Thu, Apr 24, 2008 at 2:46 PM, Guy Bashan <gu...@gmail.com> wrote:
>
>
>
>
> Hi,
>
>
>
> When I try to set using javascript the disabled property to true. I get this
> weird server exception:
>
> javax.faces.FacesException: Exception while setting value for expression :
> #{cmp_delivery.selectedEndDateYear} of component with path : {Component-Path
> : [Class: javax.faces.component.UIViewRoot,ViewId: /cmp_delivery.jsp][Class:
> javax.faces.component.html.HtmlForm,Id: formCampaignDelivery][Class:
> javax.faces.component.html.HtmlSelectOneMenu,Id: endDateYear]}
>
>         at
> javax.faces.component.UIInput.queueExceptionInRequest(UIInput.java:262)
>
>         at javax.faces.component.UIInput.updateModel(UIInput.java:243)
>
>         at javax.faces.component.UIInput.processUpdates(UIInput.java:167)
>
>         at javax.faces.component.UIForm.processUpdates(UIForm.java:91)
>
>         at
> javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:729)
>
>         at javax.faces.component.UIViewRoot.access$201(UIViewRoot.java:43)
>
>         at javax.faces.component.UIViewRoot$3.process(UIViewRoot.java:109)
>
>         at javax.faces.component.UIViewRoot.process(UIViewRoot.java:206)
>
>         at
> javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:105)
>
>         at
> org.apache.myfaces.lifecycle.UpdateModelValuesExecutor.execute(UpdateModelValuesExecutor.java:33)
>
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:103)
>
>         at
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
>
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:148)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> com.todacell.ui.view.filter.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:149)
>
>         at
> com.todacell.ui.view.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:61)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
>
>         at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>
>         at java.lang.Thread.run(Thread.java:619)
>
> Caused by: org.apache.jasper.el.JspELException: /cmp_delivery.jsp(130,48)
> '#{cmp_delivery.selectedEndDateYear}' java.lang.IllegalArgumentException
>
>         at
> org.apache.jasper.el.JspValueExpression.setValue(JspValueExpression.java:94)
>
>         at javax.faces.component.UIInput.updateModel(UIInput.java:230)
>
>         ... 30 more
>
> Caused by: java.lang.IllegalArgumentException
>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
>         at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
>
>         at
> javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
>
>         at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.access$501(FacesCompositeELResolver.java:46)
>
>         at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver$6.invoke(FacesCompositeELResolver.java:132)
>
>         at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.invoke(FacesCompositeELResolver.java:148)
>
>         at
> org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:128)
>
>         at org.apache.el.parser.AstValue.setValue(AstValue.java:114)
>
>         at
> org.apache.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
>
>         at
> org.apache.jasper.el.JspValueExpression.setValue(JspValueExpression.java:85)
>
>         ... 31 more
>
>
>
> This is the javascript code, that simply sets the disabled to "true". When I
> remark the disabled all is working fine (but not behaves as I would like):
>
>   function disableEndDate()
>
>   {
>
>     var expire = document.getElementById('formCampaignDelivery:expire');
>
>
>
>     if (expire != null)
>
>     {
>
>       var day = document.getElementById('formCampaignDelivery:endDateDay');
>
>       var month =
> document.getElementById('formCampaignDelivery:endDateMonth');
>
>       var year =
> document.getElementById('formCampaignDelivery:endDateYear');
>
>       if (expire.checked)
>
>       {
>
>         day.selectedIndex = 0;
>
>         day.disabled = true;
>
>         month.selectedIndex = 0;
>
>         month.disabled = true;
>
>         year.selectedIndex = 0;
>
>         year.disabled = true;
>
>       }
>
>       else
>
>       {
>
>         day.disabled = false;
>
>         month.disabled = false;
>
>         year.disabled = false;
>
>       }
>
>     }
>
>   }
>
>