form

Contains utility functions for dealing with forms.

Methods:

confirm_ignore_changes
consolidate_params
gen_option_range
gen_verify_box

Direct Link

confirm_ignore_changes

( selector )
Adds one or more forms to the list of forms for which to confirm changes on exit.

Parameters

  • selector String
    A jQuery selector that determines which form(s) to add.

Direct Link

consolidate_params

( [options] )
This will examine the location.search string, route parameters, and the location.hash string. It will combine the parameters together. You can specify what you want to combine and the order. If nothing is specified it will default to ['search', 'route', 'hash'].

Keep in mind that array type parameters are taken from the last item in the array. So if search has an array type parameter of filters[] and then you want to consolidate the hash parameters (hash params must exist), the previous filter params from search are completely ignored.

In the default scenario, route params gets merged into search and then hash params are merged into search.

Parameters

  • [options] Array Optional
    .
    Defaults To: search,route,hash] An array consisting of a permutation of ['search', 'route', 'hash'

Returns

Object
The combined params object.

Direct Link

gen_option_range

( start, end, [interval], [selected] )
Generates a range of number options used when generating a select input.

Parameters

  • start Number
    Starting number.
  • end Number
    Ending number.
  • [interval] Number Optional
    The interval between options.
    Defaults To: 1
  • [selected] Number Optional
    The option that should be selected by default.

Returns

Array
An array of objects, each with text and value fields. If the selected options was specified, one of the options will have a selected field set to true.

Direct Link

gen_verify_box

( ID, title, height, width, text, verification_word, button_text, callback_success )
Builds a dialog with variable text and a verification input field.

Parameters

  • ID String
    The ID of selection dialog.
  • title String
    The title of selection dialog.
  • height String
    The height of selection dialog.
  • width String
    The width of selection dialog.
  • text String
    The text to insert into selection dialog.
  • verification_word String
    The word users will type to acknowledge the change.
  • button_text String
    The text of the submit button.
  • callback_success String
    The function to be called when action has been verified successfully.