Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 499

Notice: Undefined offset: 8192 in /home/miphpf/domains/miphpf.com/public_html/includes/common.inc on line 506

Warning: Incorrect key file for table './miphpf_miphpfcom/watchdog.MYI'; try to repair it query: INSERT INTO watchdog (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', 'preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.', 2, '', 'http://www.miphpf.com/manual/dropdown_widgets.html', '', '44.200.122.214', 1728749505) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
Dropdown widgets | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

Dropdown widgets

: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/miphpf/domains/miphpf.com/public_html/includes/unicode.inc on line 291.

* Select widget example
PHP Source:

<?php
class miUserDataManager extends miDataManager  {
   
protected $_dataFields = array(
        array(
           
'field' => 'miWebFormWidgetSelect',
           
'data' => 'UserCountry'
       
)
    );

   
public function initWebForm(miWebForm $form)
    {
       
parent::initWebForm($form);

       
$options = array(
           
1 => 'United States',
           
2 => 'United Kingdom',
           
3 => 'Germany'
       
);

       
$field = $form->getFieldObj('UserCountry');
       
$field->setOptions($options);
    }
}
?>

Template:
<span>%%USERCOUNTRY%%</span>
* Select simple widget example
PHP Source:
<?php
class miUserDataManager extends miDataManager  {
   
protected $_dataFields = array(
        array(
           
'field' => 'miWebFormFieldSelect',
           
'data' => 'UserCountry'
       
)
    );
   
   
public function initWebForm(miWebForm $form)
    {
       
parent::initWebForm($form);

       
$options = array(
           
1 => 'United States',
           
2 => 'United Kingdom',
           
3 => 'Germany'
       
);

       
$field = $form->getFieldObj('UserCountry');
       
$field->setOptions($options);
    }
}
?>

Template:
<span>
    <select name="UserCountry">
        %%USERCOUNTRY%%
    </select>
</span>