It should work. Try it in Firefox with Firebug installed, check to see if there are any errors. Trying using Shift-F5 to force a reload of the page (this ensures that fresh copies of files are retrieved from the server, rather than cached copies). View the source and check that the validation JavaScript is included at the bottom of the page. Also make sure your Border component includes an <html> and <body> element ... if either is missing, no JavaScript is sent to the client.
On Sat, Oct 25, 2008 at 9:17 AM, andrethiago <[EMAIL PROTECTED]> wrote: > > Hi all! > > I'm using Tapestry 5.0.15, and I'm having some problems with validate (on > client side) a required text field in my forms. Basically, the validation > "bubble" does not appear for me. Let's show my codes. > > First, I have an entity, called Organizadora. Here's is the code: > > public class Organizadora implements Serializable { > > private static final long serialVersionUID = 1L; > // primary key > private Integer id; > // other fields > private String nome; > private String sigla; > private Set<Prova> provas; > private String url; > > public Organizadora() { > } > > public Integer getId() { > return id; > } > > public void setId(Integer id) { > this.id = id; > } > > public String getNome() { > return nome; > } > > public void setNome(String nome) { > this.nome = nome; > } > > public String getSigla() { > return sigla; > } > > public void setSigla(String sigla) { > this.sigla = sigla; > } > > public Set<Prova> getProvas() { > return provas; > } > > public void setProvas(Set<Prova> provas) { > this.provas = provas; > } > > public String getUrl() { > return url; > } > > public void setUrl(String url) { > this.url = url; > } > > public void adicionaProva(Prova prova) { > if (this.provas == null) { > this.provas = new HashSet<Prova>(); > } > prova.setOrganizadora(this); > this.provas.add(prova); > } > > @Override > public boolean equals(Object obj) { > return super.equals(obj); > } > > @Override > public int hashCode() { > return super.hashCode(); > } > > @Override > public String toString() { > return super.toString(); > } > > } > > Then, I have a page that contains a form to save a new entity. Here's the > .tml: > > <t:border t:tituloPagina="Include Organizadora" > xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> > <H3>Include Organizadora</H3> > <t:form t:id="form"> > <fieldset> > <TABLE cellSpacing="1" cellPadding="0" border="0"> > <TBODY> > <TR> > <TD><STRONG>Nome:</STRONG></TD> > <TD><t:textfield t:id="nome" > t:value="organizadora.nome" > t:validate="required" size="80"/></TD> > </TR> > <TR> > <TD><STRONG>Url:</STRONG></TD> > <TD><t:textfield size="80" t:id="url" > t:value="organizadora.url" > /></TD> > </TR> > <TR> > <TD><STRONG>Sigla:</STRONG></TD> > <TD><t:textfield size="40" t:id="sigla" > t:value="organizadora.sigla" > /></TD> > </TR> > </TBODY> > </TABLE> > </fieldset> > <div align="right"> > <INPUT t:type="submit" type="submit" value="Include" /> > </div> > </t:form> > <div align="center"> > Back to the Organizadora's list. > </div> > > </t:border> > > As you can note, the text field nome is marked as required. > > And, finally, here is the class for this .tml: > > package br.com.tiquestoes.pages; > > import org.apache.tapestry5.annotations.InjectPage; > import org.apache.tapestry5.annotations.Property; > import org.apache.tapestry5.ioc.annotations.Inject; > > import br.com.tiquestoes.dao.OrganizadoraDAO; > import br.com.tiquestoes.dominio.Organizadora; > > /** > * @author André Thiago > * > */ > public class PaginaIncluirOrganizadora { > > @Property > private Organizadora organizadora; > > @Inject > private OrganizadoraDAO organizadoraDAO; > > @InjectPage > private PaginaListaOrganizadoras paginaLista; > > private Integer id; > > public void onActivate(Integer id){ > this.id = id; > organizadora = new Organizadora(); > } > > public Object onPassivate() { > return id; > } > > Object onSubmitFromForm() { > organizadoraDAO.inserirOrganizadora(organizadora); > paginaLista.setMensagemSucesso("Entity was included > successfully."); > > return paginaLista; > } > > } > > But, as I said, when I click in the submit button, the client-side > validation is not performed. > > Did I forget anything? > > André Thiago > -- > View this message in context: > http://www.nabble.com/Tapestry-5-Problems-with-client-side-validation-tp20165551p20165551.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > 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]