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

Web Form

: 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.

miWebForm class manages the web forms used for insert or update operations. Reference to the miWebForm object can be retrieved in action object subclassed from miActionWithWebForm using the getWebForm() method.

* Adding template variables to the web form

<?php
// This adds %%USERID%% and %%USERIMAGEURL%% variables to the template
$form->addMainPageElements(
    array(
       
'%%USERID%%' => $userId,
       
'%%USERIMAGEURL%%' => $userImageUrl
   
)
);
?>
* Adding template section info the the web form
<?php
$section
= new miTemplateParserSectionInfo('users', $usersNumber, $users)
$form->addTemplateSectionInfo($section);
?>

* Manage validator objects
<?php
$validator
= new miValidatorEmail();
$form->addValidator('UserEmail', $validator);
?>

<?php
$form
->removeValidators('UserCreditCardNumber');
?>

* Get a field object
<?php
$categories
= $form->getFieldObj('CategoryID');
// 'CategoryID' field should be defined as miWebFormFieldSelect in the data manager
$categories->setOptions(
    array(
       
1 => 'Flowers',
       
2 => 'Trees',
       
3 => 'Soil'
   
)
);
?>

* Get/Set data from the web form
<?php
$userType
= $form->getFormData('UserType');
switch (
$userType)
{
case
1:
   
$userType = 'Administrator';
    break;
default:
   
$userType = 'Custommer';
}
$form->setFormData('UserType', $userType);
?>

* Change form fields
<?php
$form
->setFormFields(
    array(
        array(
           
'field' => 'miWebFormWidgetSelect',
           
'data' => 'CategoryID'
       
)
    )
);
?>

* Display template assigned with the web form
<?php
$form
->show('/templates/cart/cart.tmpl', false);
?>