Pearhtmlhtml

xiaoxiao2021-03-06  116

HTML_QUICKFORM_CONTROLLER in QuickForm is an exciting thing that can easily have verified Form code, and from the PEAR's Manual, it can be used to achieve a good Dongdong similar to the MVC structure, mainly including 3 Aspect:

HTML_QUICKFORM_CONTROLLLER controller C

HTML_QUICKFORM_PAGE: Display V

HTML_QUICKFORM_ACITION M

Let's take a look at how the QuickForm adds an element to the form. Add an element to add an element to see an increase in element type, different elements, its parameters are different, see the table below:

$ form = & new html_quickform ('frmtest', 'get');

$ form-> addelement ('header', '', 'Normal Elements'); // head element, used for illustrative text

$ form-> addelement ('hidden', 'ihidtest', 'hiddenfield');

$ form-> addelement ('text', 'itxttest', 'Test Text:');

$ form-> addelement ('textarea', 'itxatest', 'Test Textarea:', Array ('Rows' => 3, 'COLS' => 20);

$ form-> addelement ('password', 'ipwdtest', 'test password:');

$ form-> addelement ('CheckBox', 'Ichktest', 'Test Checkbox:', 'Check The Box');

$ FORM-> AddElement ('Radio', 'IradTest', 'Test Radio Buttons:', 'Check The Radio Button # 1', 1);

$ form-> addelement ('Radio', 'IradTest', '(not a group),' Check The Radio Button # 2 ', 2);

$ form-> addelement ('Button', 'ibTNTEST', 'Test Button ", array (' onclick '=>" Alert (' this is a test '); "));

$ FORM-> AddElement ('reset', 'Irestest', 'Test Reset');

$ form-> addelement ('submit', 'isubtest', 'Test Submit');

$ form-> addelement ('Image', 'IIMGTEST', 'http://pear.php.net/gifs/pear-icon.gif'Gi) (' SELECT ', "(' select ') ISELTEST ',' TEST SELECT: ', ARRAY (' a '=>' a ',' b '=>' b ',' c '=>' c ',' D '=>' d '));

$ SELECT-> Setsize (5);

$ SELECT-> SetMultiple (TRUE);

$ form-> addelement ('Date', 'DateTest1', 'Date1:', Array ('format' => 'DMY', 'MinYear' => 2010, 'MAXYEAR' => 2001));

$ form-> addelement ('Date', 'Datetest2', 'Date2:', array ('format' => 'DFY H: I', 'Language' => 'DE', 'OptioninCrement' => Array (' I '=> 5)))))))

$ form-> addelement ('Date', 'DateTest3', 'Today IS:', Array ('Format' => 'L D M Y'));

Type of elements list:

'group'

'hidden'

'reset'

'CheckBox'

'File'

'image'

'password'

'Radio'

'Button'

'Submit'

'SELECT'

'hiddenselect'

'Text'

'Textarea'

'link'

'AdvCheckbox'

'Date'

'static'

'Header'

'html'

'hierselect'

'AutoComplete'

Rule Name Parameter Rule Description

Required must be entered, can't be empty

Maxlength $ Length Maximum Character Length

MINLENGTH $ Length Minimum Character Length

Rangelength $ min, $ max character length

Regex $ RX input data must match a given regular expression

Email True (Fordnsheck) Verify the format of the email address (with an optional option to see if the domain name is valid)

Lettersonly can only be English letters

Alphaumeric can only be English letters or numbers

Numeric can only be numbers

Nopunctuation does not include the following special characters: (). / * ^? #! @ $% =, "'> <~ [] {} .nonzero cannot be zero

Compare must be the same two times

uploadedfile form element must contain correctly upload files

MaxFileSize $ SIZE uploaded the maximum capacity

MIMETYPE $ MIME Uploads the type of file, $ mime can be an array, the type of upload file must be one

The name of the file uploaded by FileName $ File_RX must meet a given regular expression

转载请注明原文地址:https://www.9cbs.com/read-101310.html

New Post(0)