Returning to Forms.

I have not been able to locate a wiki on Dolphin 7 forms so I the info below is pulled from the Dolphin 8 wiki which I would think would be close to Dolphin 7.  The question here is about selects.  I see from the wiki that I can enter a default value for the select.  However, when trying to use "value" it did not seem to set the selected attribute of the select tag to that default value (and yes, I cleared caches).  The values were listed as they were pulled from the database.  So, does the select not have a means to set the selected value?  If so, setting a default value that is different from the displayed value in the select would result in incorrect settings.  Some feedback on this would be appreciated.

  • select - select one from all available values. It is displayed as HTML combo-box.
    Parameters:
    • value - default value (array index of selected item from values array), or empty - if there is no default value.
    • values - serialized array of available values, or reference to predefined set of values.
    • checked - not applicable here.
    • collapsed - not applicable here.
    • html - not applicable here.
    • checker_func
      Can be used here: Length, Preg, Avail
      Make no sense to use it here: Email, Date, DateTime, Captcha
    • db_pass
      Can be used here: Int, Float, Xss, All, Preg
      Make no sense to use it here: Date, DateTime, Tags, Categories, XssHtml, Boolean, Set
Geeks, making the world a better place
Quote · 3 Aug 2013

value - default value (array index of selected item from values array)

Looking at this again, the value entry is an array that contains the selected item?  I would appreciate some insight on how this works and how I can set one of the options in the select tag as selected.

Geeks, making the world a better place
Quote · 3 Aug 2013

Ok. Lets say your select looks like this.

<select size="1" name="test">
<option value="yes">Yes</option>
<option value="no">No</option>
</select>

The form would look like this,

'values' => array(
    'no' => 'Yes',
    'yes' => 'No',
),
'value' => 'Yes',


If your select looks like this instead.

<select size="1" name="test">
<option value="1">Yes</option>
<option value="0">No</option>
</select>

Then the form values would look like this.

'values' => array(
    '0' => 'Yes',
    '1' => 'No',
),
'value' => '1',

https://www.deanbassett.com
Quote · 3 Aug 2013

Thanks Dean.  An array dump might be in order to see what is what although a source view might tell me the same.

Geeks, making the world a better place
Quote · 3 Aug 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.