NextDB.net

Class net.nextdb.html.Form

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

class net.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

net.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
net.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 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 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 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:net.nextdb.validate.EMAIL,
 COLUMN_NAME:net.nextdb.validate.STRONG_PASSWORD,
 COLUMN_NAME:email:net.nextdb.validate.OPTIONAL} 
or you can write your own rule in the form of a regular expressions, for example:
{COLUMN_NAME:/REGEX/} 

Field Detail

BOX_LAYOUT

<static> Object BOX_LAYOUT

HORIZONTAL_LAYOUT

<static> Object HORIZONTAL_LAYOUT

VERTICAL_LAYOUT

<static> Object VERTICAL_LAYOUT

Constructor Detail

net.nextdb.html.Form

net.nextdb.html.Form()

Method Detail

afterRenderCallback

Object afterRenderCallback(<Function> callback)

cancelCallback

Object cancelCallback(<Function> callback)

confirmFields

Object confirmFields(<Array> confirm)

defaultValues

Object defaultValues(<Object> defaultValues)

destroy

Object destroy()

expandFields

Object expandFields(<Array> expand)

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)

validation

Object validation(validation)

NextDB.net

Documentation generated by JSDoc on Sat May 8 13:48:56 2010