I think I'm doing something wrong here

Following Howard post, I tried :

@Inject
private BindingSource _source;

public void setupRender () {
Binding b = _source.newBinding("Parameter Disabled", _componentSources .getEmbdededComponent("myComponentId").getComponentResources(), "prop", "disabled");
        b.set(true);
}

Tapestry gives me : Expression disabled for class org.apache.tapestry.corelib.component.TextField is read-only.

Thanks and Best Regards,

Eric
--
Eric BIANCHI
http://www.rodanotech.ch


Le 17 janv. 08 à 16:05, Eric BIANCHI a écrit :

Hello List,

Using Tapestry 5, I'd like to dynamically set the disabled attribute of a Field depending of its id. So, on the same form, I could say : component1 has the disabled attribute set to true, component2 has the disabled attribute set to false and so on.

I tried the following on the page containing the form :

method 1 :

@Inject
private ComponentResources _componentSources;

_componentSources .getEmbdedComponent(myId).getComponentResources().set... nothing because there is only the isDisabled method available.

So I tried

method  2 :

<t:textfield t:id="component1" disabled="prop:disabledMethod" />

where disabledMethod is :

if (_componentSources .getEmbdedComponent(myId).getComponentResources().isRendering()) return true;

return false;

It works well until I submit the form, at this point, the component is not rendering, disabledMethod returns false (from what I have understood) and my field is set to null.

Any hints would be highly appreciated.

Thanks and best regards,

Eric

--
Eric BIANCHI
http://www.rodanotech.ch



Reply via email to