State
is_valid()¶
Convenience method to check if validation passed
1 | is_valid() |
@return bool
Example
Useful for displaying a general success message in a template
1 2 3 | <?php if ( $form->is_valid() ) : ?> <p>Success!</p>' <?php endif; ?> |
has_errors()¶
Convenience method to check if form has input errors
1 | has_errors() |
@return bool
This is a shorthand for $form->errors()->is_populated()
Example
Useful for displaying a general error message in a template
1 2 3 | <?php if ( $form->has_errors() ) : ?> <p>Whoops, some field(s) are not valid</p>' <?php endif; ?> |