HTML Form tag generation
package | salt\view |
---|
HTMLtag(string $tagName, array $attributes, string $content= NULL
, integer $tagType= self::TAG_FULL
) : string
string
name of the HTML tag
array
attributes of the tag
string
content of tag : Have to be an escaped HTML String
integer
type of tag : self::TAG_*
string
HTML tagcheckbox(string $name, string $value= NULL
, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
) : string
Unchecked box will return 0 and not an unset name like standard checkbox
This tag work with and without javascript
With javascript, if you set the checkbox value (to one of 1/0), you need jQuery AND call change() after val(...)
string
name of the tag
string
value of the tag
array<mixed,string>
CSS classes of the tag
array<mixed,mixed>
all other attributes for the tag
string
HTML text tagend() : string
string
HTML end form tagfield(\salt\Field $field, string $name, mixed $value, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
, \salt\Converter $helper= NULL
) : string
For a HTML tag of an existing DAO object, use $dao->FORM->$field instead
\salt\Field
the field
string
name of the HTML tag, can be NULL for use the $field->name
mixed
Have to be in DAO format (timestamp for date, TRUE/FALSE for boolean, etc...)
array<mixed,string>
CSS classes. Each element can contains multiple classes separated by space
array<mixed,mixed>
others HTML attributes : key=>value
\salt\Converter
The helper to use for format the value
string
HTML tag for the fieldget(string $action= NULL
, array<mixed,mixed> $params= array()
, array<mixed,mixed> $others= array()
) : string
string
Page to send form, NULL for reuse current page
array<mixed,mixed>
List of parameters to add in hidden input. Can be name => value or just name for reusing value in current query.
If name is "*", all parameters in current query are reused.
Example : array('a', 'b'=>2, 'c'=>3) with query a=0&b=1&d=4 will produce hidden inputs :
array<mixed,mixed>
Other attributes to add in form tag
string
HTML form taggetName(string $name) : string
string
simple tag/field name
string
$name or $name in template if we use withNameContainer()getValue(string $name) : mixed
string
name of input (simple name, not the return of self::getName() !)
\salt\SaltException |
if called outside a form |
---|
mixed
value in GET/POST for this name, with nameContainer supportinput(string $name, string $type= 'text'
, string $value= NULL
, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
) : string
string
name of the tag
string
value of type attribute
string
value of the tag
array<mixed,string>
CSS classes of the tag
array<mixed,mixed>
all other attributes for the tag
string
HTML text tagpost(string $action= NULL
, array<mixed,mixed> $params= array()
, array<mixed,mixed> $others= array()
) : string
string
Page to send form, NULL for reuse current page
array<mixed,mixed>
List of parameters to add in method URL. Can be name => value or just name for reusing value in current query.
If name is "*", all parameters in current query are reused.
Example : array('a', 'b'=>2, 'c'=>3) with query a=0&b=1&d=4 will produce method="...?a=0&b=2&c=3"
array<mixed,mixed>
Other attributes to add in form tag
string
HTML form tagradio(string $name, string $options, string $value= NULL
, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
) : array<mixed,string>
string
name of the tag
string
all possible values key=>value
string
value of the tag
array<mixed,string>
CSS classes of the tag
array<mixed,mixed>
all other attributes for the tag
array<mixed,string>
HTML text tagregisterJSPageLoaded() : string
string
the javascript keyregisterJSTokenValue(string $key, string $value, string $valueKey= NULL
, string $tokenSeparator= "\n"
) : string
string
The key of registerJavascript()
string
Value to use for replace {$key}
string
key for value, multiple call with same key replace the value
string
separator for muliple values
string
$valueKeyregisterJavascript(string $key, string $jsCode) : string
string
The key to use for append code : every previous code registered with this key is replaced
string
The javascript code
string
the $keyselect(string $name, array<mixed,mixed> $options, string $value= NULL
, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
) : string
string
name of the tag
array<mixed,mixed>
all possible values in one of theses formats :
key=>array('value' => displayValue, 'attr' => attrValue, ...)
group_label=>array('group' => array(key=>value))
group_label=>array('group' => array(key=>array('value' => displayValue, 'attr' => attrValue, ...)))
string
value of the tag
array<mixed,string>
CSS classes of the tag
array<mixed,mixed>
all other attributes for the tag
string
HTML text tagsetValue(string $name, mixed $value)
string
name of input (simple name, not the return of self::getName() !)
mixed
value to set
\salt\SaltException |
if called outside a form |
---|
textarea(string $name, string $value= NULL
, array<mixed,string> $classes= array()
, array<mixed,mixed> $others= array()
) : string
string
name of the tag
string
value of the tag
array<mixed,string>
CSS classes of the tag
array<mixed,mixed>
all other attributes for the tag
string
HTML text taguseImprovedCheckbox(string $value = TRUE
)
Improved checkbox use jQuery for handle a checkbox mapped to a hidden select field with 0 et 1 values
string
FALSE for disable improved checkbox
withJQueryUI(boolean $value = TRUE
)
boolean
TRUE (default) for enable JQueryUI, false for disable
withNameContainer(string $name)
string
... $name all names containers : (a, b, c) will give a[b][c][component_name]
withoutNameContainer()
buildSelectOptions(array<mixed,mixed> $options, mixed $selected) : string
array<mixed,mixed>
all possible values in one of theses formats :
key=>array('value' => displayValue, 'attr' => attrValue, ...)
group_label=>array('group' => array(key=>value))
group_label=>array('group' => array(key=>array('value' => displayValue, 'attr' => attrValue, ...)))
mixed
selected value(s)
string
HTML text for $optionscommonTagAttributes(string $name, string $value, array<mixed,string> $classes, array<mixed,mixed> $attrs) : array<mixed,mixed>
string
name of the tag
string
value of the tag
array<mixed,string>
array of CSS classes, each element can contain multiple classes separated by spaces
array<mixed,mixed>
all others attributes : key=>value
array<mixed,mixed>
attributes to use in tag : key=>valuehttpBuildQuery(array<mixed,mixed> $params) : string
parseParams(string $query, array<mixed,string> $params) : array<mixed,string>
string
Query of URL in QUERY_STRING format : var1=value1&var2=value2...
array<mixed,string>
List of varX to keep or redefine. '*' for reuse all request parameters, key=>NULL for remove key parameter
array<mixed,string>
key=>value$javascriptCodes : array<mixed,string>
array()
$javascriptTokens : array<mixed,string>
array()
$method : string
NULL
$nameContainer : string
NULL
$useImprovedCheckbox : boolean
TRUE
$values : array<mixed,mixed>
NULL
content | if nameContainer is used, contains GET/POST values that are resolved early for retrieve form values. |
---|
$withJQueryUI : boolean
TRUE
FORMAT_KEY = 'format'
PARAM_DATEPICKER = '_saltDatePicker'
RAW = 'raw'
TAG_CLOSE = 2
TAG_FULL = 0
TAG_OPEN = 1