You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Casey Link <ca...@outskirtslabs.com> on 2015/06/18 16:22:01 UTC
Best method to reuse a TextField configuration
Hi,
I have a TextField repeated many times that has a certain type, validate, and class attributes set. Only the value and id changes.
What is the proper Tapestry way to prevent the repeating of all those options?
For example, if a css class changes, I want to set it in one place not a 100.
I attempted to create a component with the tml:
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
<t:content>
<t:TextField t:id="input"
...custom attrs here..."/>
</t:content>
</html>
And the Java:
public class CustomInput {
@Inject
private Environment environment;
@Component(id = "input", publishParameters = "value")
private TextField input;
public String getClientId() {
return input.getClientId();
}
}
But this didn't work. The rendered field didn't have the type or validate attrs set.
Would this be a better job for a mixin?
Thanks,
Casey
--
Casey Link
Outskirts Labs { http://outskirtslabs.com }
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Best method to reuse a TextField configuration
Posted by Lance Java <la...@googlemail.com>.
I think the problem is
publishParameters = "value"
If you want validate and type you need
publishParameters = "value,validate,type"
Re: Best method to reuse a TextField configuration
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 18 Jun 2015 11:22:01 -0300, Casey Link <ca...@outskirtslabs.com>
wrote:
> Hi,
Hi!
> I have a TextField repeated many times that has a certain type,
> validate, and class attributes set. Only the value and id changes.
Create a component with this TextField inside.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org