# vim: ts=3 sw=3 et ft=org
#+TITLE: Validate Action Element
#+STYLE: <LINK href='../stylesheet.css' rel='stylesheet' type='text/css' />
#+AUTHOR: Rusty Klophaus (@rustyio)
#+OPTIONS:   H:2 num:1 toc:1 \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+EMAIL: 
#+TEXT: [[file:../index.org][Getting Started]] | [[file:../api.org][API]] | [[file:../elements.org][Elements]] | [[file:../actions.org][*Actions*]] | [[file:../validators.org][Validators]] | [[file:../handlers.org][Handlers]] | [[file:../config.org][Configuration Options]] | [[file:../about.org][About]]

* Validate Action - #validate {}

  This action tells Nitrogen to validate input fields during a postback or blur event.

** Usage

#+BEGIN_SRC erlang
   wf:wire(myButton, myTextbox, #validate { validators=[
     #is_required { text="Required." }
   ]})
#+END_SRC

** Attributes

   + on - (/atom, submit by default/) :: Set to 'submit' to validate fields during a postback. Set to 'blur' to validate when the field loses focus.

   + success\_text - (/String/) :: Text to display next to a field when the field passes validation.

   + validators - (/Validator, or List of Validators/) :: The validators to run on this field.

   + attach\_to - (/atom/) :: Specify the id of a Nitrogen element to attach to. By default, the validator will attach to the target of the action.

** See Also

   + [[./base.html][base action]]

   + [[./clear_validation.html][clear validation action]]
