HTML Form tag generation
| package | salt\view |
|---|
HTMLtag(string $tagName, array $attributes, string $content= NULL, integer $tagType= self::TAG_FULL) : string
stringname of the HTML tag
arrayattributes of the tag
stringcontent of tag : Have to be an escaped HTML String
integertype of tag : self::TAG_*
stringHTML 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(...)
stringname of the tag
stringvalue of the tag
array<mixed,string>CSS classes of the tag
array<mixed,mixed>all other attributes for the tag
stringHTML text tagend() : string
stringHTML 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\Fieldthe field
stringname of the HTML tag, can be NULL for use the $field->name
mixedHave 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\ConverterThe helper to use for format the value
stringHTML tag for the fieldget(string $action= NULL, array<mixed,mixed> $params= array(), array<mixed,mixed> $others= array()) : string
stringPage 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
stringHTML form taggetName(string $name) : string
stringsimple tag/field name
string$name or $name in template if we use withNameContainer()getValue(string $name) : mixed
stringname of input (simple name, not the return of self::getName() !)
\salt\SaltException |
if called outside a form |
|---|
mixedvalue 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
stringname of the tag
stringvalue of type attribute
stringvalue of the tag
array<mixed,string>CSS classes of the tag
array<mixed,mixed>all other attributes for the tag
stringHTML text tagpost(string $action= NULL, array<mixed,mixed> $params= array(), array<mixed,mixed> $others= array()) : string
stringPage 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
stringHTML form tagradio(string $name, string $options, string $value= NULL, array<mixed,string> $classes= array(), array<mixed,mixed> $others= array()) : array<mixed,string>
stringname of the tag
stringall possible values key=>value
stringvalue 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
stringthe javascript keyregisterJSTokenValue(string $key, string $value, string $valueKey= NULL, string $tokenSeparator= "\n") : string
stringThe key of registerJavascript()
stringValue to use for replace {$key}
stringkey for value, multiple call with same key replace the value
stringseparator for muliple values
string$valueKeyregisterJavascript(string $key, string $jsCode) : string
stringThe key to use for append code : every previous code registered with this key is replaced
stringThe javascript code
stringthe $keyselect(string $name, array<mixed,mixed> $options, string $value= NULL, array<mixed,string> $classes= array(), array<mixed,mixed> $others= array()) : string
stringname 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, ...))) stringvalue of the tag
array<mixed,string>CSS classes of the tag
array<mixed,mixed>all other attributes for the tag
stringHTML text tagsetValue(string $name, mixed $value)
stringname of input (simple name, not the return of self::getName() !)
mixedvalue 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
stringname of the tag
stringvalue of the tag
array<mixed,string>CSS classes of the tag
array<mixed,mixed>all other attributes for the tag
stringHTML text taguseImprovedCheckbox(string $value = TRUE)
Improved checkbox use jQuery for handle a checkbox mapped to a hidden select field with 0 et 1 values
stringFALSE for disable improved checkbox
withJQueryUI(boolean $value = TRUE)
booleanTRUE (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, ...))) mixedselected value(s)
stringHTML text for $optionscommonTagAttributes(string $name, string $value, array<mixed,string> $classes, array<mixed,mixed> $attrs) : array<mixed,mixed>
stringname of the tag
stringvalue 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>
stringQuery 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
TRUEFORMAT_KEY = 'format'
PARAM_DATEPICKER = '_saltDatePicker'
RAW = 'raw'
TAG_CLOSE = 2
TAG_FULL = 0
TAG_OPEN = 1