Invoke tapestry form validation on the client side

I just read a mail on the users list discussing this matter so I'll post it here with some links as a future reference for me and other searchers on the web.


First this mail enlightened me that one can control his when would tapestry client side validation be invoked by tapestry in the first place. The form component's parameter "clientValidation" can be set to different values from the "ClientValidation" enum.


So the guy asking wanted tapestry to validate his form before the form submits and no when the input fields blurs. Setting the "clientValidation" parameter to "submit" will do just that.


Now to the main point, what if we would like tapestry to ALSO validate a specific field based on another event ?


Event.observe($(' fieldNeedOnBlurValidation '), 'blur', function(event) {
$('fieldNeedOnBlurValidation').getFieldEventManager().validateInput();
});





I claim that this applies to tapstry's default javscript framework, Protoype. Please correct me if I'm wrong. Anyway jQuery users will have to adapt their code to do the same logic to get the same results.

Comments

Popular posts from this blog

Hosting Apache Tapestry5.1 on GAE (Google App Engine)

Apache Tapestry PageActivationContext tutorial

Testing SOAP services using pingdom