Hi all, I'm very new to binding and I found an article on the mailing list
that seemed pretty close what I needed in regards to dynamic disabling. I'm
trying to dynamically disable particular fields within my form at different
states. These fields will come from the db and selected within my for loop.
I have the following code and I get the following exception.

Caused by: org.apache.tapestry5.ioc.internal.util.TapestryException:
Expression 'disabled' for class
org.apache.tapestry5.corelib.components.TextField is read-only.
        at
org.apache.tapestry5.internal.bindings.PropBinding.set(PropBinding.java:76)
        at
org.healthresearch.eprs.components.PurchaseRequestForm.onValidateFromPR(PurchaseRequestForm.java:416)
        at
org.healthresearch.eprs.components.PurchaseRequestForm$Shim_b586eaee4d4e0.invoke(Unknown
Source)
        at
org.apache.tapestry5.internal.plastic.MethodHandleImpl.invoke(MethodHandleImpl.java:48)
        at
org.apache.tapestry5.internal.transform.BaseEventHandlerMethodInvoker.invokeEventHandlerMethod(BaseEventHandlerMethodInvoker.java:53)
        ... 114 more

Could someone please guide me and tell me what I'm doing wrong? 


       @Inject
        private Request req;
        @Inject
        private ComponentResources componentResources;
        @Inject
        private BindingSource source;

        void setupRender() {
        for (String field : req.getParameterNames()) {
            if (field.equals("quanity")) {
                ComponentResources component =
componentResources.getEmbeddedComponent(field).getComponentResources();

                String defaultPrefix = "prop";
                String description = "descrip";
                String expression = "disabled";

                Binding b = source.newBinding(description, component,
defaultPrefix, expression);
                b.set(true);
            }
        }
        }

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Dynamic-Disabled-fields-with-binding-tp5023027p5023027.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to