This might help:
http://tapestry.apache.org/tapestry5/guide/validation.html

You can access your form and input components by injection, and then do
form.recordError(field, ...).




2009/7/31 Vjeran Marcinko <vjeran.marci...@email.t-com.hr>

> Hello,
>
> I have created multi-form-field component (eg, DateRangeEditor component
> that has two DatePickers inside that are used to set "start" and "end" dates
> for DateRange domain class).
> When Form that contains this DateRangeEditor component submits, the
> component gets notified about this via "afterSubmit" handler triggered by
> SubmitNotifier placed inside DateRangeEditor.
>
> Inside "aftersubmit" handler I do custom validation that start date is
> prior to end date, and I want to register my custom error to Form component
> that contains my DateRangeEditor component, but I dunno how to fetch Form
> component instance to register it? Or is this kind of validation done
> someway differently?
>
> And one more question - is it possible to register optional validator for
> some form field programmatically? I can create desired FieldValidator via
> injected FieldValidatorSource, but returning null when I don't want
> validation to be set raises NPE 'cause null is not allowed to be set:
>
>   public FieldValidator getMyRuntimeFieldValidator() {
>       if (isValidationRequired) {
>           return fieldValidatorSource.createValidators(someField,
> "required");
>       }
>       return null;
>   }
>
> Regards,
> Vjeran
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to