jFormer DocumentationAdvanced Fields

Name

JFormComponentName(String id, String label[, Array optionArray])

The Name field allows users to enter in their first and last name, with the middle initial being optional.

Usage

Constructor

	new JFormComponentName(String id, String label[, Array optionArray])

Sample Usage

Create an date component:

	$address = new JFormComponentName('id', 'Label:', array());

Value Returned

Object

Keys: { firstName, middleInitial, lastName }

CSS Class

.jFormComponentName

Options

true

showSubLabels

Boolean | turns off the input fields sublabels if false. Useful when emptyValues are set to true to prevent redundancy..

false

emptyValues

Boolean | Places an empty value in each of the text input fields so that the labels are shown inline, when true.

false

middleInitialHidden

Boolean | hides the middle initial field if set to true.

null

initialValue

Array Keys: [firstName, middleInitial, lastName] | Receives an associative array which presets the value for these components. .

Component Options

These options are common to all components.

null

description

HTML | a description for the component, shows underneath the component inside a DIV with the class jFormComponenpescription.

null

instanceOptions

Array, [max(int), addButtonText(string), removeButtonText(text)] | see instanceOptions page for more information.

null

dependencyOptions

Array, [dependentOn(string), display(string), jsFunction(Javascript)[, animationOptions(array)]] | see dependencyOptions page for more information.

null

triggerFunction

Javascript | a javascript function that runs upon component change.

null

tip

HTML | a tooltip that displays whenever the component has focus. Gives any extra help or explanation a form user might need.

null

validationOptions

Array | an of validations specific to the component, see the specific component for its validations.

false

showErrorTipOnce

Boolean | this option makes the error tip only show up on the first focus on the component if it does not pass validation.

false

enterSubmits

Boolean | if true pressing enter while this component has focus submits the form, or advances to the next page.

null

style

CSS | set the style attribute for the component wrapper div.

null

initialValue

String | preset the value of the component upon form loading.

Validation Options

NameDescription
required

Makes the component required, the entered value may not be white space or empty.

only the firstName and lastName field are required. if middleinitial is shown it is never required.

First Name is required.

Last Name is required.

			'validationOptions' => array('required')
		

Example

  • Demo
  • View Source

Date Component Example

Next Section: Form Features

This page was last edited on April 25, 2011 at 1:38pm.

3 comments (add a comment)

soccerjf on 2011-08-21 10:13:38

when you pass the array use "initialValues" vs "initialValue", add the "s"

OgdenRoyal on 2011-11-09 05:27:45

Also, the example for this page is a date object. Not 'Name'. And the comment submission 'cancel' button reads "previous"

Erick on 2012-03-24 16:41:11

'showSubLabels' should be 'showSublabels' (labels needs to be lowercase)