Categories

.uiForm()

Categories: UI

.uiForm( [ options ] )

Subclass: ep

Plugin: ep.ui.form

Description: Advanced form handling.

  • .uiForm( [ options ] )

    version added: 6.11.0

    options   A map of additional options pass to the method.

The .uiForm() method add advanced form handling, like ajax or validate, to a form.

Default handling:

  • prevent submit if no action attribute givn
  • prevent submit if an element of the form invalid
  • Apply .uiForm() to all forms and set an ajax handle for submit.

    Code:
    ep('form')
        .uiForm({
            compareDiff: true,
            ajax: {
                success: function( successText ){
                    alert( successText );
                },
                error: function( errorText ){
                    alert( errorText );
                }
            }
        });
    
    
  • compareDiff

    version added: 6.11.0

    A boolean indication wether to submit changed form only.

    Default: false

  • ajax

    version added: 6.11.0

    A map of ajax options to send form via ajax. If no url givn the action attribute will be used as url, same works for type/method.

  • isValid

    • .uiForm( 'isValid' )

      version added: 6.11.0

    Get a boolean indication wether the elements of the form are valid.

  • setValid

    • .uiForm( 'isValid', valid )

      version added: 6.11.0

      valid   A boolean indication whether to set the valid state of the form.

    Set the validity state of the form to true (valid) or false (invalid).