|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Form Object |
|
Form |
Instantiate a new Form object |
Usage: |
$frm = new Form(string name,[string
action],[string method],[string id],[object
required],[bool showheaders]) |
Parameters: |
string name - The
name attribute of the Form. string action - Optional - The action attribute of the Form. string method - Optional - The method attribute of the Form. Default is 'post'. string id - Optional - The id attribute of the Form. If no value is passed the name attribute is used. object required - Optional - A collection object containing initial elements information. See the section on Initial Elements in the EasyForms documentation for more info. bool showheaders - Optional - Indicates whether or not to display the section headers. This overrides individual section properties. Default is True. |
Returns: |
A reference to the Form object. |
| Form Object Methods | |
| AddButton | Add a button to the forms Buttons
collection. Note: When a new form is created, a default
submit button is added automatically. |
| Usage: | $frm->AddButton(string name,
string value, [string type], [string onclick]) |
| Parameters: | string name The name attribute
of the button. string value The value attribute of the button. string type Optional The Type attribute of the button. string onclick Optional An OnClick client side function name. |
| Returns: | N/A |
| AddColumn | Add a column to the forms Columns collection. |
| Usage: | $frm->AddColumn() |
| Parameters: | None |
| Returns: | N/A |
| AddRow | Add a row to the forms Rows collection. |
| Usage: | $frm->AddRow() |
| Parameters: | None |
| Returns: | N/A |
| AddSection | Add a section to the forms Sections
collection. |
| Usage: | $frm->AddSection(string name,
[bool seplabel], [bool showheader],[int
col], [int row]) |
| Parameters: | string name The name of
the section used as the header. bool seplabel Optional Indicates if the field labels should be placed next to the field, or on the next line. Default is False. bool showheader Optional Indicates whether or not the section header should be displayed. Default is True. int col Optional Indicates which form column the section will be rendered in. Default is 0. int row Optional Indicates which form row the section will be rendered in. Default is 0. |
| Returns: | N/A |
| AddElement | Add an element to the forms Elements
collection. |
| Usage: | $frm->AddElement(string field,
int sort, [bool required], [bool hidden],[string
val],[int row], [int col], [int section]) |
| Parameters: | string field The name of
the new element. int sort The sort order of the new element. bool required Optional - If the element is required. Default is False. bool hidden Optional If the element is displayed as a hidden input type. Default is False string value Optional The initial value of the element. int row Optional in what section row will this element be placed int col Optional in what section column will this element be placed int section Optional in what section will this element be placed |
| Returns: | N/A |
| ListElements | List all the elements associated with the
form. |
| Usage: | echo $frm->ListElements() |
| Parameters: | None |
| Returns: | An HTML formatted string. |
| ChangeElementOrder | Changes the sort order of a form element. |
| Usage: | $frm->ChangeElementOrder(int elementindex,
int newindex) |
| Parameters: | int elementindex - The index of the field you
want to change. int newindex - The new index where you want the field placed. |
| Returns: | N/A |
| RemoveElement | Removes an Element from the forms Elements array. |
| Usage: | $frm->RemoveElement(int elementindex) |
| Parameters: | int elementindex - The index of the element
you want to remove. |
| Returns: | N/A |
| ToHTML | Display the form. |
| Usage: | echo $frm->ToHTML() |
| Parameters: | None |
| Returns: | An HTML formatted string. |
| Form Object Properties | |
| Name | Set or Get the name of the form. |
| Usage: | $frm->Name([string name]) |
| Parameters: | string name Optional
The name of the Form. |
| Returns: | The current form name attribute. |
| Action | Set or Get the action of the form. |
| Usage: | $frm->Action([string action]) |
| Parameters: | string action - Optional - Url
to the action page attribute. |
| Returns: | The current form action attribute. |
| Align | Set or Get the alignment of the form. |
| Usage: | $frm->Align([string align]) |
| Parameters: | string align - Optional - Valid
values are left, center, right. |
| Returns: | The current form alignment attribute value. |
| Id | Set or Get the id of the form. |
| Usage: | $frm->Id([string Id]) |
| Parameters: | string Id Optional
The forms id attribute. Default is the name attribute. |
| Returns: | The current form Id attribute. |
| Method | Set or Get the method of the form. |
| Usage: | $frm->Method([string method]) |
| Parameters: | string method Optional
The form method attribute. Default is post. |
| Returns: | The current method attribute value of the form. |
| MultiPart | Set or Get if the form is to be submitted as a
multipart form. When set to true, the enctype attribute of the form is set to
'multipart/form-data'. This is used when you use a form element of type 'file'. |
| Usage: | $frm->MultiPart([bool enctype]) |
| Parameters: | bool enctype Optional
The form is a multipart. Default is False. |
| Returns: | The current multipart attribute value of the form. |
| ShowHeaders | Set or Get if the forms section headers should
be rendered. |
| Usage: | $frm->ShowHeaders([bool>show]) |
| Parameters: | bool>show Optional
Show section headers. Default is True. |
| Returns: | True or False. |
| ReqImagePath | Set or Get the path to the Required Image file. |
| Usage: | $frm->ReqImagePath([string path]) |
| Parameters: | string path Optional A valid
system path. |
| Returns: | The current Required Image path. |
| UseReqImage | Set or Get the if you want to use a required Image file. |
| Usage: | $frm->UseReqImage([bool use]) |
| Parameters: | bool use Optional True or
False. |
| Returns: | True or False. |
| ValidateForm | Set or Get if you want to generate client side validation
code. |
| Usage: | $frm->ValidateForm([bool validate]) |
| Parameters: | bool validate Optional True or False. |
| Returns: | True or False. |
| ShowAll | Set or Get if all form elements are displayed. |
| Usage: | $frm->ShowAll([bool use]) |
| Parameters: | bool use Optional True or
False. |
| Returns: | True or False. |
| HideAll | Set or Get if you want to make all form elements hidden. |
| Usage: | $frm->HideAll([bool use]) |
| Parameters: | bool use Optional True or
False. |
| Returns: | True or False. |
| Form Object Collections | ||
| Columns
|
Holds the columns in the form. | foreach ($frm->Form>Columns as $col) { $col->Width (50%); } |
| Rows
|
Holds the rows in the form. | foreach ($frm->Rows as $row) { $row->Height(50%); } |
| Sections
|
Holds the sections in the form. | foreach ($frm->Sections as $section) { echo $section->Name(); } |
| Elements | Holds the elements in the form. | foreach ($frm->Elements as $element) { echo $element->Value() ; } |
| Buttons | Holds the buttons in the form. | foreach ($frm->Buttons as $btn) { echo $btn->Type(); } |
| Element Object Methods | |
| SetControl | Sets the control type of a field. |
| Usage: | $frm->Elements[x]->SetControl
(string type, [object conn], [string sql]) |
| Parameters: | string type The type of
control. Valid types are 'select', 'textbox', 'textarea', 'file', 'radio', 'checkbox', 'label',
'password', and 'cc_expire'. object conn Optional A valid connection object. Used only for Select control. string sql Optional SQL string used to fill options. Used only for Select control. |
| Returns: | N/A |
| Element Object Properties | |
| Name | Get or Set the name attribute of the field. |
| Usage: | $frm->Elements[x]->Name([string name]) |
| Parameters: | string name Optional
The text used as the name of the field. |
| Returns: | The current name attribute of the field. |
| Label | Get or Set the text used as the field label. |
| Usage: | $frm->Elements[x]->Label ([string
label]) |
| Parameters: | string label Optional
The text used for the field label. Default is the name set to proper
case. |
| Returns: | The current label of the field. |
| LabelColor | Set or Get the color of the field label. |
| Usage: | $frm->Elements[x]->LabelColor([string
color]) |
| Parameters: | string color
Optional A string containing a valid HTML color or equivalent color code (#FFFFFF). |
| Returns: | The current Label Color. |
| LabelWeight | Set or Get if the text used as the field label
is bold or normal. |
| Usage: | $frm->Elements[x]->LabelWeight
([var weight]) |
| Parameters: | var weight Optional
A var representing the Label weight. Valid values are (0,1,normal,bold) |
| Returns: | The current label weight. |
| Type | Get the type attribute of the field. Read Only |
| Usage: | $frm->Elements[x]->Type () |
| Parameters: | None |
| Returns: | The current type attribute of the field. |
| Value | Set or Get the Value of the field. |
| Usage: | $frm->Elements[x]->Value ([string
value]) |
| Parameters: | string value Optional
The field value. |
| Returns: | The current value of the field. |
| Sort | Get or Set the sort order of the field. |
| Usage: | $frm->Elements[x]->Sort ([int sort]) |
| Parameters: | int sort Optional
An integer to indicate the sort position of the field. If a number higher then the
number of Elements is passed, the next highest number is used. For example, if you use
100, and there are only 5 Elements, 6 will be used. |
| Returns: | The current sort order of the field. |
| Required | Gets or Sets if the field is a required field. |
| Usage: | $frm->Elements[x]->Required([bool
required]) |
| Parameters: | bool required
Optional 0 No, 1 Yes. Default is False |
| Returns: | True or False |
| Visible | Gets or Sets whether the field will be used in
the form. |
| Usage: | $frm->Elements[x]->Visible([bool visible]) |
| Parameters: | bool visible
Optional 0 No, 1 Yes. Default is True. |
| Returns: | True or False |
| Hidden | Gets or Sets whether the field is rendered as
a hidden field. |
| Usage: | $frm->Elements[x]->Hidden([bool
hidden]) |
| Parameters: | bool hidden
Optional 0 False, 1 True. Default is False. |
| Returns: | True or False |
| SectionRow | Gets or Sets the section row the field will be
rendered in. |
| Usage: | $frm->Elements[x]-> SectionRow([int
row]) |
| Parameters: | int row Optional
An integer to indicate which section row the field will be placed in. Default is 0. |
| Returns: | The current section row number. |
| SectionCol | Gets or Sets the section column the field will
be rendered in. |
| Usage: | $frm->Elements[x]-> SectionCol([int
col]) |
| Parameters: | int col Optional - An
integer to indicate which section column the field will be placed in. Default is 0. |
| Returns: | The current section column number. |
| Section | Gets or Sets what section the field will be
rendered in. |
| Usage: | $frm->Elements[x]->Section([int section]) |
| Parameters: | int section Optional
An integer to indicate which section the field will be placed in. Default is 0. |
| Returns: | The current section number. |
| ReqImagePath | Set or Get the path to the Required Image file. |
| Usage: | $frm->Elements[x]->>ReqImagePath([string
path]) |
| Parameters: | string path Optional A valid
system path. |
| Returns: | The current Required Image path. |
| UseReqImage | Set or Get the if you want to use a required Image file. |
| Usage: | $frm->Elements[x]->UseReqImage([bool use]) |
| Parameters: | bool use Optional True or
False. |
| Returns: | True or False. |
| Validate Object Properties | |||||||||
| AllowFirstItem | Set or Get if a select control should allow
the first item. (Selectbox only) |
||||||||
| Usage: | $frm->Elements[x]->Validate->AllowFirstItem
([bool allow]) |
||||||||
| Parameters: | bool allow Optional -
True or False. |
||||||||
| Returns: | True or False. | ||||||||
| AllowWhitespace | Set or Get if the control should allow
whitespace. |
||||||||
| Usage: | $frm->Elements[x]->Validate->AllowWhitespace([bool
allow]) |
||||||||
| Parameters: | bool allow Optional -
True or False. |
||||||||
| Returns: | True or False. | ||||||||
| ControlType | Get or Set the validation control type. |
||||||||
| Usage: | $frm->Elements[x]->Validate->ControlType([string
type]) |
||||||||
| Parameters: | string type - Optional - The
name of a valid control type. See the list below. Default is Textbox.Control Types
|
||||||||
| Returns: | The current Control Type. | ||||||||
| ControlName | Get or Set the Control Name. |
||||||||
| Usage: | $frm->Elements[x]->Validate->ControlName([string
name]) |
||||||||
| Parameters: | string name - Optional - The
name of the control. |
||||||||
| Returns: | The current control name. | ||||||||
| Decimal | Set or Get the decimal position if any. |
||||||||
| Usage: | $frm->Elements[x]->Validate->Decimal([int
decimal]) |
||||||||
| Parameters: | int decimal - Optional - The
number of decimal points. |
||||||||
| Returns: | The currrent Decimal value. | ||||||||
| DisplayName | Get or Set the Display Name of the control
used to alert client upon validation. |
||||||||
| Usage: | $frm->Elements[x]->Validate->DisplayName([string
name]) |
||||||||
| Parameters: | string name - Optional - A
string containing the name you would like displayed to the client upon validation. |
||||||||
| Returns: | The current DisplayName value. | ||||||||
| Group | A character used to seperate or Group a number
entry. |
||||||||
| Usage: | $frm->Elements[x]->Validate->Group([string
group]) |
||||||||
| Parameters: | string group - Optional - The
char to use as the group seperator. |
||||||||
| Returns: | The current Group value. | ||||||||
| MinLength | The minimum length of the field entry. |
||||||||
| Usage: | $frm->Elements[x]->Validate->MinLength([int
min]) |
||||||||
| Parameters: | int min - Optional - An integer
representing the minlength. |
||||||||
| Returns: | The current MinLength value. | ||||||||
| MaxLength | The maximum length of the field entry. |
||||||||
| Usage: | $frm->Elements[x]->Validate->MaxLength([int
max]) |
||||||||
| Parameters: | int max - Optional - An integer
representing the maxlength. |
||||||||
| Returns: | The current MaxLength value. | ||||||||
| GreaterThen | Set or Get a value to measure aginst. The
value entered in the form field must be greater then this value. |
||||||||
| Usage: | $frm->Elements[x]->Validate->GreaterThen([variant
val]) |
||||||||
| Parameters: | variant val - Optional - A value
to measure aginst. |
||||||||
| Returns: | The current GreaterThen value. | ||||||||
| LessThen | Set or Get a value to measure aginst. The
value entered in the form field must be less then this value. |
||||||||
| Usage: | $frm->Elements[x]->Validate->LessThen([variant
val]) |
||||||||
| Parameters: | variant val - Optional - A value
to measure aginst. |
||||||||
| Returns: | The current LessThen value. | ||||||||
| Aginst | Set or Get the name of a form element to
validate the control aginst. This could be usd to verify new password entries. |
||||||||
| Usage: | $frm->Elements[x]->Validate->Aginst([string
fld]) |
||||||||
| Parameters: | string fld - Optional - The name
of another form element to validate aginst. Default is NULL. |
||||||||
| Returns: | The current Aginst value. | ||||||||
| Pattern | Get or Set the string pattern to validate
aginst. |
||||||||
| Usage: | $frm->Elements[x]->Validate->Pattern([string
pattern]) |
||||||||
| Parameters: | string pattern - Optional - A
sequence of characters, digits, and other characters used to validate aginst. |
||||||||
| Returns: | The current pattern string. | ||||||||
| Required | Set or Get if the control is to be validated
as required. |
||||||||
| Usage: | $frm->Elements[x]->Validate->Required([bool
req]) |
||||||||
| Parameters: | bool req - Optional - True or
False. |
||||||||
| Returns: | True or False | ||||||||
| CCTypeField | Set or Get the name of the form element which
contains the credit card type. This is used to validate an element with a ValidateType of
'creditcard' See Below. Default is NULL. |
||||||||
| Usage: | $frm->Elements[x]->Validate->CCTypeField([string
fld]) |
||||||||
| Parameters: | string fld - Optional - The name
of the control which contains the creditcard type value. |
||||||||
| Returns: | The current CCTypeField value. | ||||||||
| ValidateType | Get or Set the validation type of the control.
See the table below for a list of valid types. Setting this will also set the Pattern
property. |
||||||||
| Usage: | $frm->Elements[x]->Validate->ValidateType([string
type]) |
||||||||
| Parameters: | string type - Optional - A
string containing a valid validation type.Validate Types
NOTE: If the validation type is set to creditcard, you
must also set the CCTypeField property. |
||||||||
| Returns: | The current validation type. | ||||||||
| Control Object Methods | |
| AddOption | Add an Option to the referenced Select
control.(Select Only) |
| Usage: | $frm->Elements[x]->Control->AddOption(string
text, string value) |
| Parameters: | string text - The option text. string value - The option value. |
| Returns: | N/A |
| Bind | Bind the Select control to the database and
populate options. The control is automatically bound when it is created, so if you
add any options you must Bind the control again. (Select Only) |
| Usage: | $frm->Elements[x]->Control->Bind
([object conn], [string sql]) |
| Parameters: | object conn - Optional - A valid
database connection object. string sql Optional - A valid SQL statement. |
| Returns: | N/A. |
| Control Object Properties | |
| Name | Set or Get the Name attribute of the control. |
| Usage: | $frm->Elements[x]->Control->Name
([string name]) |
| Parameters: | string name The Name attribute of the control. |
| Returns: | The current Size of the control. |
| ID | Set or Get the ID attribute of the control. |
| Usage: | $frm->Elements[x]->Control->ID
([int id]) |
| Parameters: | int id an integer repersenting the ID attribute of the control. |
| Returns: | The current ID of the control. |
| Size | Set or Get the Size attribute of the control. |
| Usage: | $frm->Elements[x]->Control->Size ([int size]) |
| Parameters: | int size an integer repersenting the Size attribute of the control. |
| Returns: | The current Size of the control. |
| Font | Set or Get the Font style of the control. |
| Usage: | $frm->Elements[x]->Control->Font([string
font]) |
| Parameters: | string font - The font to use. |
| Returns: | The current Font. |
| FontSize | Set or Get the Fontsize style of the control. |
| Usage: | $frm->Elements[x]->Control->FontSize([string
size]) |
| Parameters: | string size - An integer
representing the fontsize in pt. |
| Returns: | The current Fontsize. |
| FontWeight | Set or Get the Fontweight style of the
control. |
| Usage: | $frm->Elements[x]->Control->FontSize([var
weight]) |
| Parameters: | string weight - A var
representing the Fontweight. Valid values are (0,1,normal,bold) |
| Returns: | The current Fontweight. |
| MaxSize | Set or Get the Maxsize attribute of the
control. (TextBox Only) |
| Usage: | $frm->Elements[x]->Control->MaxSize([string
msize]) |
| Parameters: | string msize - An integer
representing the maxsize attribute of the control. |
| Returns: | The current Maxsize. |
| Type | Get the Type of control. (Read Only) |
| Usage: | $frm->Elements[x]->Control->Type() |
| Parameters: | None |
| Returns: | The current control Type. |
| Disabled | Set or Get if the control is disabled. |
| Usage: | $frm->Elements[x]->Control->Disabled([bool
disabled]) |
| Parameters: | bool disabled - Optional - True
or False |
| Returns: | True or False. |
| Rows | Set or Get the number of Rows attribute.
(Textarea Only) |
| Usage: | $frm->Elements[x]->Control->Rows([int
rows]) |
| Parameters: | int rows - Optional - Number of
rows to display. |
| Returns: | The current number of Rows. |
| Cols | Set or Get the number of Cols attribute.
(Textarea Only) |
| Usage: | $frm->Elements[x]->Control->Cols([int
cols]) |
| Parameters: | int cols - Optional - Number of
rows to display. |
| Returns: | The current control Type. |
| Connection | Set a valid database connection object. (Write
Only) (Select Only) |
| Usage: | $frm->Elements[x]->Control->Connection(object
conn) |
| Parameters: | object conn - A valid database
connection object. |
| Returns: | N/A |
| SQL | Set or Get a valid SQL statement used to
populate a Select control. (Select Only) |
| Usage: | $frm->Elements[x]->Control->SQL
([string sql]) |
| Parameters: | string sql A valid SQL statement. |
| Returns: | The current SQL statement. |
| SelectedIndex | Set or Get a valid SQL statement used to
populate a Select control. (Select Only) |
| Usage: | $frm->Elements[x]->Control->SQL
([string sql]) |
| Parameters: | string sql A valid SQL statement. |
| Returns: | The current SQL statement. |
| OnChange | Set or Get the client side function to run
when a onChange event occurs. |
| Usage: | $frm->Elements[x]->Control->OnChange([string
function]) |
| Parameters: | string function - Optional - A
valid client side function name with parameters. Example: 'checkControl(this)' |
| Returns: | The current OnChange value. |