Hmmm...I know the tapestry workbench demo application has a sample "ShowErrors" sort of component for this.
The biggest reason I suggested the ValidationDelegate approach is because you're guaranteed to get every fields value and error written out properly as everything is passed in as a paramter to you. I'm not as familiar with your method, but maybe the workbench? ... On 1/31/06, Christian Mittendorf <[EMAIL PROTECTED]> wrote: > > Error tracking is working really nice, that is not the problem. My > problem is that not every form field does record its input value to > the trackingFields. Textfields do always record their values, even if > no error occured. > > On my page I'm iterating the trackingFields while I'm building up the > form with all its form fields. In code it does almost look like this: > > <form> > <fieldTracking.iterator...> > <errorField.next> > <inputField> > <errorField.next> > <inputField> > <submit> > </form> > > And it's working fine - as long as all your input fields are > TextFields/DatePicker/TextArea. All error messages are shown close to > their related input fields. > > But if you change a TextField to a PropertySelection or a Checkbox, > this model is no longer working. > > The list of entries does not match the number of form components > inside the form, as these form components do not record their input > values to the fieldTrackings. These fields do only record their error > message to the fieldTrackings. > > Any idea on how to display the error messages as in my example? > > Christian > > > Am 01.02.2006 um 00:44 schrieb Ron Piterman: > > > I don't know why checkbox propertySelection aso don't have > > validator, I guess they are not that common, but you can validate > > them in your submit/form listener and add trackings to the > > delegate, making the errors apear on each IFormComponent... > > > > you just call one of the error tracking methods on the delegate. > > make sure you use one that needs a IFormComponent as parameter, and > > your error will be recorded for this field. > > Also, you can record errors for fields which have validators if you > > perform some extra validation which is not done by the validator, > > like consistency etc. > > > > Hope that helps, > > > > Cheers, > > Ron > > > > Christian Mittendorf wrote: > >> Hello! > >> I'm currently exploring how Tapestry 4 is validating fields and > >> tracking error messages. > >> Can someone please tell me if I'm right with the following > >> assumptions: > >> - _every_ error is tracked in the ValidationDelegates fieldTrackings > >> - _only_ the content of form elements that extend ValidField or > >> implement TranslatedField is stored in FieldTrackings > >> Therefore only the following form elements will always be > >> available from the fieldTrackings, even if no error was recorded > >> for them: > >> - DatePicker, TextArea, TextField (they implement TranslatedField) > >> - ValidField (as of Tapestry 4 deprecated) > >> This does lead me to the following question: why isn't the input > >> of other form elements (like i.e. Checkbox, PropertySelection) > >> handled the same way as TranslatedFields are? > >> Isn't this behavior contrary to the documentation of > >> IValidationDelegates method "recordFieldInputValue()". The > >> JavaDocs say: > >> "Records the user's input for the current form component. Input > >> should be recorded even if > >> there isn't an explicit error, since later form-wide validations > >> may discover an error in the > >> field." > >> What I want to do is to show error messages from the form > >> delegate next to the form field (text field, check box, drop > >> down, etc) where the error is recorded. Is there a known way to > >> do it? > >> Christian > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: tapestry-user- > >> [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
