> Previously I used a component > with parameters, but that interfered with validation
I'd go with a component. Your trouble with validation was possibly that you were trying to validate based on the id of the textfield from within your AxFormField component instead of the id of the AxFormField component? Validation is an event which bubbles up through it's containers. Using a component is the right approach when you want/have to use a template. Josh On Wed, May 25, 2011 at 12:36 PM, wkm <w...@zanoccio.com> wrote: > Hi, > > I'm trying to create a mixin that pulls together a textfield, its label, and > error message with the appropriate styling. Previously I used a component > with parameters, but that interfered with validation. > > Is it possible for a mixin to render a component? > > I find myself continually writing: > > <t:AxFormField> <!-- simple <div> wrapping component --> > <t:label t:for="txtfield" /> > <div class="ax_input"> > <t:error > class='literal:errorMsg' > id="${txtfield}-msg" > for="txtfield" > /> > <t:textfield > class='input txtinput' > t:label="${label}" > t:id="txtfield" > /> > </div> > </t:AxFormField> > > Which is pretty error prone. > > I'd, instead like to write: > > <t:textfield > t:mixin="AxField" > t:label="Username" > t:id="txtfield" > /> > > Or something to that effect. > > However, then the AxField mixin has to be able to include components > somehow, which doesn't seem possible. > > It seems like my only option is to make a wrapper component, eg, AxForm, > that pre-processes the body, expanding Textfield components. > > Is this as insane as it sounds? > > Thank you! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org