Thank you Stephan this works perfect and it was a big step in my understanding of Tapestry. Do you mind if i create a wiki articel out of your code example?
-----Ursprüngliche Nachricht----- Von: Stephan Windmüller [mailto:stephan.windmuel...@cs.tu-dortmund.de] Gesendet: Mittwoch, 17. Februar 2010 16:23 An: users@tapestry.apache.org Betreff: Re: AW: Cross Validation in dynamic Forms Dominik Gätjens wrote: > I read this thread but don't understand it. Do you have a code example for me? The setup is complex. Follow these steps and let me know if there is anything unclear: 1. Save controlNames of all fields If your field has the id "myField", use this code: ----- private Map<Object, String> controlNames; void onValidateFromMyField(Object value) { if (controlNames == null) { controlNames = new HashMap<Object, String>(); } controlNames.put(paper, myField.getControlName()); } ----- Object is the current value you are iterating over, depending on your page. Verify in onValidateForm that all controlNames are set. 2. Create your own component SimpleField: ---- public class SimpleField implements Field { private String controlName; public void setControlName(String controlName) { this.controlName = controlName; } public String getControlName() { return this.controlName; } [...] } ---- Put it in your tml and inject it in your page code. 3. Use both in onValidateForm Check the submitted values in onValidateForm. If a field should be marked, set the controlName of the simpleField and record an error for it. HTH Stephan --------------------------------------------------------------------- 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