My component extends AbstractBaseComponent. Its a class I created to work as a parent for all my components. That way I can use inheritance to customize my components at will.
AbstractBaseComponent itself extends BaseComponent. On 7/24/06, Shing Hing Man <[EMAIL PROTECTED]> wrote:
Oops ! What I said about the missing delegate is rubbish. The validator should work without it. (I have tested it.) There should not be any difference whether a component is defined explicitly (in jwc or .page) or implicitly (in .html). The java class of your component extends AbstractComponent. I thought if your component has a html tmeplate, you need to extend from BaseComponent. (But then James has said it works for him.) Shing --- Rui Pacheco <[EMAIL PROTECTED]> wrote: > I am looking at another project where I defined the > form inline in the HTML > and it worked without it. I just defined a form as > <form jwcid="[EMAIL PROTECTED]"> > and had no problems. > > Whats the difference between declaring the form > properties inline and in the > component specification, why does it work in one > instance and not on the > other? > > I know I could put the form specification in the > html template, but I want > to keep all my specifications in the component > specification. Its just the > philosophy we chose for our project. > > On 7/24/06, Shing Hing Man <[EMAIL PROTECTED]> wrote: > > > > I think you have left out the delegate attribute > in > > the Form component. > > > > > http://tapestry.apache.org/tapestry4/tapestry/ComponentReference/Form.html > > > > Shing > > > > > > --- Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > Here they go: > > > > > > This is my .jwc: > > > <?xml version="1.0" encoding="UTF-8"?> > > > <!DOCTYPE component-specification PUBLIC > "-//Apache > > > Software > > > Foundation//Tapestry Specification 4.0//EN" " > > > > > > http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> > > > <component-specification > > > class="pt.te.universal.components.login.Login" > > > allow-body="no" allow-informal-parameters="no"> > > > > > > <component id="form" type="Form"> > > > <binding name="listener" > > > value="listeners.doLogin"/> > > > </component> > > > > > > <component id="uname" type="TextField"> > > > <binding name="value" > value="ognl:uname"/> > > > <binding name="validators" > > > value="validators:required"/> > > > </component> > > > > > > <component id="password" type="TextField"> > > > <binding name="value" > > > value="ognl:password"/> > > > <binding name="hidden" > value="ognl:true"/> > > > <binding name="validators" > > > value="validators:required"/> > > > </component> > > > > > > <asset name="submit" > > > path="imagens/botao_ok_up.gif"/> > > > </component-specification> > > > > > > This is my .java: > > > public abstract class Login extends > > > AbstractBaseComponent { > > > > > > public abstract String getUname(); > > > public abstract String getPassword(); > > > > > > > > > public void doLogin(IRequestCycle cycle){ > > > > > > System.err.println(getUname()); > > > } > > > } > > > > > > This is my .html: > > > <table width="100%" border="0" cellspacing="0" > > > cellpadding="2"> > > > <tr><td class="titulo">Login</td></tr> > > > <tr><td><input type="text" style="FONT-SIZE: > > > 9px; WIDTH: 100px; HEIGHT: > > > 19px" jwcid="uname"/></td></tr> > > > <tr><td class="titulo">Password</td></tr> > > > <tr><td width="81%"><input jwcid="password" > > > type="password" > > > style="FONT-SIZE: 9px; WIDTH: 100px; HEIGHT: > > > 19px"/></td></tr> > > > <tr><td width="81%"><input type="image" > jwcid=" > > > [EMAIL PROTECTED]" > > > width="23" height="17" > > > image="asset:submit"/></td></tr> > > > </table> > > > > > > On 7/24/06, Shing Hing Man <[EMAIL PROTECTED]> > wrote: > > > > > > > > I have no problem with validators for a > TextField > > > > within a custom component. > > > > > > > > You might like to post your component's > .java, > > > .jwc. > > > > and .html and see if anyone in the list can > help. > > > > > > > > Shing > > > > > > > > > > > > --- Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > > > > > Hi all > > > > > > > > > > I've been knocking my head on the wall > trying to > > > > > find whats wrong here, and > > > > > I can't see anything. > > > > > > > > > > I have a set of fields, inside a form, in an > > > html > > > > > snippet I defined as a > > > > > component. I created a html file that > contains > > > just > > > > > a snippet of that file, > > > > > a .jwc file that contains the definition for > the > > > > > elements inside the > > > > > template and a corresponding class. > > > > > > > > > > Everything works fine, except for > Validators. > > > > > > > > > > I the .jwc file I defined my fields as being > > > > > required, but there is no > > > > > validation being done at runtime. If I don't > > > insert > > > > > something on the fields, > > > > > I get an NPE on my bean, which is obviously > > > > > expecting something from the > > > > > template. > > > > > > > > > > I've had validators work before, and the > > > difference > > > > > between those pages and > > > > > this one is the fact that I'm doing > everything > > > > > inside a .jwc and not a .page > > > > > file. > > > > > > > > > > This is my component definition: > > > > > <component id="password" type="TextField"> > > > > > <binding name="value" > > > > > value="ognl:password"/> > > > > > <binding name="hidden" > > > value="ognl:true"/> > > > > > <binding name="validators" > > > > > value="validators:required"/> > > > > > </component> > > > > > > > > > > Has anyone seen anything like this? Have you > had > > > > > validators working on > > > > > component definitions? > > > > > -- > > > > > Cumprimentos, > > > > > Rui Pacheco > > > > > > > > > > > > > > > > > Home page : > > > > http://uk.geocities.com/matmsh/index.html > > > > > > > > > > > > > > > > > > > > > > ___________________________________________________________ > > > > Copy addresses and emails from any email > account > > > to Yahoo! Mail - quick, > > > > easy and free. > > > http://uk.docs.yahoo.com/trueswitch2.html > > > > > > > > > > > > > > --------------------------------------------------------------------- > === message truncated === Home page : http://uk.geocities.com/matmsh/index.html ___________________________________________________________ Try the all-new Yahoo! Mail. "The New Version is radically easier to use" – The Wall Street Journal http://uk.docs.yahoo.com/nowyoucan.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Cumprimentos, Rui Pacheco
