NextDB.net

Class nextdb.html.Form

Object
   |
   +--nextdb.html.Form
Direct Known Subclasses:
nextdb.html.InsertForm, nextdb.html.UpdateForm, nextdb.html.QueryForm

class nextdb.html.Form


The form builder library offers three distinct database operations: inserts, updates and queries. The library also offers a variety of simple convenience features including automatic form validation or custom regex preferences for form validation, layout control, date pickers, file uploaders, custom default values, dropdown lists, captcha protection, ordering, and callback function registries for responses. This is a good tutorial on this api: http://nextdb.net/examples/forms.html

nextdb.html.Form is an abstract super class not meant for instantiation.


Defined in api.docs.js

See:


Field Summary
<static>  Object BOX_LAYOUT
          
<static>  Object HORIZONTAL_LAYOUT
          
<static>  Object VERTICAL_LAYOUT
          
 
Constructor Summary
nextdb.html.Form()
           
 
Method Summary
 Object afterRenderCallback(<Function> callback)
           callback function executed immediately after form is added to DOM. This is useful if you want to perform custom modifications to the form's DOM structure.
 Object cancelCallback(<Function> callback)
           callback function executed when the cancel button is clicked.
 Object columnAliases(<Object> aliases)
           by default the form fields will be labeled with the column name minus any underscores, so a column 'user_comments' will appear on the form as 'user comments' but with aliases your can override that naming convention by supplying a different label
  { "user_comments" : "Any comments?" }    
 Object confirmFields(<Array> confirm)
           duplicates the given fields so the user has to enter the same thing twice to ensure spelling.
 Object defaultValues(<Object> defaultValues)
           optionally pre-populate the form with default values, for example: {first_name:"John",last_name:"Doe"}
 Object destroy()
           remove form from div and tear down the form.
 Object expandFields(<Array> expand)
           optionally makes given text fields expandable textareas for multi-line input from the user, generally used for messages, comments, blog posts etc.
 Object fail()
           fail a particular submit, use this with the interceptor
 Object interceptor(<Function> interceptor)
           register request interceptor that will be passed the parameter map of column/values just before being sent to server, for instance
    formInstance.interceptor(function(p){
        // set timestamp to now
        p.timestamp="now";
        // get some other parameter
        alert(p.name);
    });
 Object layout(<int> layout)
           define the layout of the form, either box (default) horizontal or vertical.
 Object message(<String> msg,<String> color)
           report custom message to form user (this appears above the form).
 Object obscureFields(<Array> obscure)
           converts given fields to password field e.g.
 Object omitFields(<Array> omit)
           optionally remove certain fields from the form, these fields will not be passed to the server, so any default column values on the server will be honored.
 Object options(<Object> options)
           optionally define drop down list options to contrain the input from the user for certain fields, for example:
 { sex : {M : "Male", F : "Female", O : "Other"},
   state : {CA : "California", NY : "New York"} } 
 Object orderFields(<Array> order)
           optionally order fields in the form, otherwise the field ordering will default to the natural column order in the database, this will also omit the fields not represented in the array which is a nice short cut way to omit and order all in one call.
 Object setMessageId(<String> id)
           allows you to set the element/div id for the error/info message field.
 Object timeoutMessage(<String> timeoutMessage)
           Set the timeout message for the form building
 Object validation(validation)
           by default all of the form fields are required, you can override the default by specifying validation rules of your own. We offer some standard built in rules, for example:
{COLUMN_NAME:nextdb.validate.EMAIL,
 COLUMN_NAME:nextdb.validate.STRONG_PASSWORD,
 COLUMN_NAME:email:nextdb.validate.OPTIONAL} 
or you can write your own rule in the form of a regular expressions, for example:
{COLUMN_NAME:/REGEX/} 
 Object whileLoading(<String> whileLoading)
           set the HTML to render into the div while the form builder builds the form depending on the network latency, you might not even see this.

Field Detail

BOX_LAYOUT

<static> Object BOX_LAYOUT

HORIZONTAL_LAYOUT

<static> Object HORIZONTAL_LAYOUT

VERTICAL_LAYOUT

<static> Object VERTICAL_LAYOUT

Constructor Detail

nextdb.html.Form

nextdb.html.Form()

Method Detail

afterRenderCallback

Object afterRenderCallback(<Function> callback)

cancelCallback

Object cancelCallback(<Function> callback)

columnAliases

Object columnAliases(<Object> aliases)

confirmFields

Object confirmFields(<Array> confirm)

defaultValues

Object defaultValues(<Object> defaultValues)

destroy

Object destroy()

expandFields

Object expandFields(<Array> expand)

fail

Object fail()

interceptor

Object interceptor(<Function> interceptor)

layout

Object layout(<int> layout)

message

Object message(<String> msg,<String> color)

obscureFields

Object obscureFields(<Array> obscure)

omitFields

Object omitFields(<Array> omit)

options

Object options(<Object> options)

orderFields

Object orderFields(<Array> order)

setMessageId

Object setMessageId(<String> id)

timeoutMessage

Object timeoutMessage(<String> timeoutMessage)

validation

Object validation(validation)

whileLoading

Object whileLoading(<String> whileLoading)

NextDB.net

Documentation generated by JSDoc on Fri Apr 1 10:54:23 2011