Class: AddressForm

AddressForm(div_id, options)

new AddressForm(div_id, options)

An address form
Parameters:
Name Type Description
div_id string ID of form container
options JSON Options for form customization -- Optional --

List of JSON attributes

  • language: {string} Display language (default: 'th')
    • 'th': Thai
    • 'en': English
  • layout: {int} Layout format (default: AddressForm.SIMPLE_SELECT)
    • AddressForm.SIMPLE_SELECT = 1
    • AddressForm.SIMPLE_SELECT_FULLFORM = 2
    • AddressForm.SIMPLE_SUGGEST = 3
    • AddressForm.SIMPLE_SUGGEST_FULLFORM = 4
    • AddressForm.STANDARD = 5
  • style: {string} Name of css file including .css extension
  • showLabels: {bool} Show form labels (default: true)
  • required: {JSON}
    • key: {string} ID of an input field
    • value: {bool} required if true, not required if false
  • label: {JSON}
    • key: {string} ID of an input field
    • value: {string} Label display text
  • placeholder: {JSON}
    • key: {string} ID of an input field
    • value: {string} Placeholder display text
  • bigLabelFont: {string} Font family for big labels
  • smallLabelFont: {string} Font family for small labels
  • errorLabelFont: {string} Font family for error labels
  • map: {string} ID of map container
  • debugDiv: {string} ID of a div to show form data
Source:

Methods

getFormJSON() → {JSON}

Get form data in JSON format and show it in debug div if the div is set
Source:
Returns:
Form's JSON data
Type
JSON

hideLabels()

Hide form labels and move those labels to placeholders instead
Source:

resetForm()

Reset form values
Source:

setBigLabelFontFamily(family)

Set font family for big labels
Parameters:
Name Type Description
family string Selected font family (Ex. "Times New Roman")
Source:

setDebugDiv(div_id)

Set div for showing form data
Parameters:
Name Type Description
div_id string ID of a div to show form data
Source:

setErrorLabelFontFamily(family)

Set font family for error labels
Parameters:
Name Type Description
family string Selected font family (Ex. "Times New Roman")
Source:

setLabelText(type, text)

Set label text for an input field
Parameters:
Name Type Description
type string ID of the input field
text string Label display text
Source:

setLanguage(lang)

Set language of the form using javascript
Parameters:
Name Type Description
lang string Language code ('th','en')
Source:

setPlaceholder(type, text)

Set placeholder text for an input field
Parameters:
Name Type Description
type string ID of the input field
text string Placeholder display text
Source:

setRequired(type, bool)

Set an input field as required
Parameters:
Name Type Description
type string Name of the input field
bool bool "required" value
Source:

setSmallLabelFontFamily(family)

Set font family for small labels
Parameters:
Name Type Description
family string Selected font family (Ex. "Times New Roman")
Source:

setStyle(filename)

Set style of the form using CSS
Parameters:
Name Type Description
filename string CSS file name (including .css)
Source:

showLabels()

Show form labels
Source:

unbindDebugDiv()

Unbind and stop debug div from showing form data
Source: