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: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]