Beginner's level Tapestry:

Bind the disabled parameter of each field to a property that returns
true when the field should be disabled and false otherwise.

Journeyman level Tapestry:

An alternative would be to define a special kind of binding for this
purpose.  I'd need more details, but a BindingFactory has access to
the component resources of the containing component and the resources
of the component whose property is being bound.  Between the two, you
should be able to define a Binding instance that returns true or false
under the correct circumstances.

On Jan 17, 2008 7:05 AM, Eric BIANCHI <[EMAIL PROTECTED]> wrote:
> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to