User Tools

Site Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
helper_field_select [2018/08/29 14:08] – [Helper Field 'select'] Adjust intro for 'select'. Traumflughelper_field_select [2019/02/22 18:39] (current) – [Parameter Description] thirty bees learned cast 'priceval'. Traumflug
Line 18: Line 18:
     'desc'          => $this->l('Description of the field.'),     'desc'          => $this->l('Description of the field.'),
     'auto_value'    => false,     'auto_value'    => false,
-    'value'         => 'bar', 
     'identifier'    => 'my_use',     'identifier'    => 'my_use',
 +    'value'         => 'bar',
     'list'          => [     'list'          => [
         [         [
Line 65: Line 65:
 == 'defaultValue' == == 'defaultValue' ==
 Value to use if //'auto_value'// is unset or set to true, but neither a matching POST request parameter, nor a matching database entry is present. Defaults to an empty string. Value to use if //'auto_value'// is unset or set to true, but neither a matching POST request parameter, nor a matching database entry is present. Defaults to an empty string.
 +
 +== 'identifier' ==
 +String which identifies the key in these pairs inside entries in //'list'//. **Mandatory**.
  
 == 'value' == == 'value' ==
 Select the HTML menu entry with this value. Requires //'auto_value'// to be set to //false//. Defaults to an empty string. Select the HTML menu entry with this value. Requires //'auto_value'// to be set to //false//. Defaults to an empty string.
  
-== 'identifier' == +Notably, as Option Fields are usually set in the class constructor, this value gets set before default procedures had a chance to process the incoming requestAccordingly, setting a value here should parse the request as needed while doing so. Else the shown value is always one version behind.
-String which identifies the key in these pairs inside entries in //'list'//**Mandatory**.+
  
 == 'list' == == 'list' ==
-List of options to fill the HTML select with. Each option is an array with two key-value pairs. **Mandatory**, an empty array is allowed.+List of options to fill the HTML select with. Each option is an array with two key-value pairs. **Mandatory**. An empty array gives no selector at all. To get an empty selectore.g. to fill it with JavaScript, define an entry with a pair of empty strings.
  
 == 'list':[identifier] == == 'list':[identifier] ==
Line 85: Line 87:
  
 == 'cast' == == 'cast' ==
-Name of a PHP casting function to convert the submitted value with. Unlike with other Helper fields, this cast gets applied to each menu option before rendering as well as after submit. Can be //boolval//, //floatval// or //intval//. Default is a string.+Name of a PHP casting function to convert the submitted value with. Unlike with other Helper fields, this cast gets applied to each menu option before rendering as well as after submit. Can be //boolval//, //floatval//, //priceval// or //intval//. Default is a string.
  
 == 'class' == == 'class' ==
Line 143: Line 145:
   </label>   </label>
   <div class="col-lg-9">   <div class="col-lg-9">
-    <div class="input-group myclass"> +    <select class="form-control fixed-width-xxl myclass" 
-      <input class="form-control myclass+            name="MYCONTROLLER_OPTION
-             id="myid+            onchange="selectionChanged();
-             size="10+            id="MYCONTROLLER_OPTION
-             name="MYCONTROLLER_OPTION+            size="1"> 
-             value="" +      <option value="foo">Use Foo!</option> 
-             placeholder="placeholder text" +      <option value="barselected="selected">Use bar!</option
-             type="text"> +      <option value="baz">Use BAZ!</option
-      <span class="input-group-addon">units</span+    </select>
-    </div>+
   </div>   </div>
   <div class="col-lg-9 col-lg-offset-3">   <div class="col-lg-9 col-lg-offset-3">
helper_field_select.1535544485.txt.gz · Last modified: 2018/08/29 14:08 by Traumflug