I am have a form for which I have written custom element validation. In the validation handler I am calling form_set_error on the element and the form is not being submitted. However, The messages variable is not being printed out until a page reload (or jump to different path).

I am building the form in a page callback with drupal_get_form() (it is before the theme layer). There are #title attributes on all of the form elements in the form and the validation is doing as it should (just a page late).

On my local machine it seems like the $messages variable is being correctly set, but is hitting a 404 page (and I think being printed before the redirect? (missing image)). On the server I am hosting it on it is not hitting a 404, but is printing out the $messages a page too late.

Anyone run into this before?

Comments

BigEngland’s picture

Project: Views (for Drupal 7) » Form API Validation
Version: 7.x-3.0 » 7.x-2.0
Component: Miscellaneous » Code
Issue tags: +form validation, +form_set_error
pere orga’s picture

You are probably calling the webform too late.

See http://drupal.stackexchange.com/q/8223/10086

pedrofaria’s picture

Assigned: Unassigned » pedrofaria
Status: Active » Closed (works as designed)

Sorry, but it's not the wright place for Drupal Support.

BigEngland’s picture

It was being called too late. I switched the $messages variable to be created in a preprocess node function. Thanks! netol