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/webform_widgets.html', '', '3.144.109.5', 1713486026) in /home/miphpf/domains/miphpf.com/public_html/includes/database.mysql.inc on line 121
Web Form Widgets | MIPHPF - Your Open Source RAD PHP Framework
Skip navigation.
Home

Web Form 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.

Widgets are PHP wrappers of web form input fields. They process data from a single (rarely multiple) HTML input field(s). Widgets can be explicitly created in the source, but preferred approach is to map them in a miDataManager subclass.

In template widgets represent the whole input box (including HTML).
For simple widgets in the templates is used this construct:
<span>
    <input type="text" name="UserLogin" value="%%USERLOGIN%%" />
</span>
For ordinary widgets:
<span>%%USERLOGIN%%</span>

* Map widgets

<?php
class wsProductsDataManager extends miDataManager  {
   
protected $_dataFields = array(
        array(
           
'field' => 'miWebFormFieldText',
           
'data' => 'ProductID'
       
),
        array(
           
'field' => 'miWebFormWidgetSelect',
           
'data' => 'ProductColor'
       
),
        array(
           
'field' => 'miWebFormWidgetText',
           
'data' => 'ProductName',
        )
    );
}
?>
* Create widget at runtime
<?php
class wsProductsDataManager extends miDataManager  {
   
public function initWebForm(miWebForm $form)
    {
       
parent::initWebForm($form);
       
       
$productOptions = miUtil::getDBArray('SELECT ProductOptionID, ProductOptionName FROM ProductOptions', 'ProductOptionID', 'ProductOptionName');
       
       
$productOptionsSelect = new miWebFormWidgetSelect($form);
       
$productOptionsSelect->setFieldName('ProductOptions');
       
$productOptionsSelect->setOptions($productOptions);
       
       
$form->addMainPageElements(array('%%PRODUCTOPTIONS%%' => $productOptionsSelect->getEditableControl()));
    }
}
?>