1

Right now I am working on a custom module where I have a 'view' page for viewing fields from my custom table in my database. The page basically just lists the field labels and values. I plan to have a feature to email the information on the page when the user clicks on a link/button, but only after certain fields are valid. Now if the fields aren't valid, I want to redirect to an 'edit' form page so that the user can edit certain fields. I also want to apply the form validate functions at the same time, so that inputs the user has to fix would already by highlighted in red.

However after looking at the form api and form quickstart guides, it seems to me that the only way to do that is to have the user click a submit button. Is there anyway to apply a validation function to the form right after it is loaded?

  • you might be able to do it with form_alter() BEFORE the form is displayed, eg, set things in red etc from the start – Jimajamma Aug 3 '12 at 18:24
  • 1
    Jquery Validation ? – GoodSp33d Aug 3 '12 at 19:14
3

Clientside Validation will do your job.

You may however have to modify a javascript a little bit by incorporating jQuery('input').blur(function(){ //invoke the clientside validation });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.