|
Revision 271, 2.9 kB
(checked in by argh, 3 years ago)
|
Fixed bug #172: modified behavior of the setValue for the set element so that you may pass either a string for a single selected value, or an array with a list of selected entries; fixed bug #173 in patForms_Rule_URL: translated missing french strings.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
include_once 'patExampleGen/prepend.php'; |
|---|
| 19 |
$exampleGen->displayHead( 'Example' ); |
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
require_once $neededFiles['patForms']; |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
require_once $neededFiles['patErrorManager']; |
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
$elementsDefinition = array( |
|---|
| 37 |
'wishlist' => array( |
|---|
| 38 |
'type' => 'Set', |
|---|
| 39 |
'attributes' => array( |
|---|
| 40 |
'required' => 'yes', |
|---|
| 41 |
'display' => 'yes', |
|---|
| 42 |
'edit' => 'yes', |
|---|
| 43 |
'label' => 'Wishlist', |
|---|
| 44 |
'title' => 'Wishlist', |
|---|
| 45 |
'description' => 'Pick your wishes in the list.', |
|---|
| 46 |
'size' => 'auto', |
|---|
| 47 |
'maxsize' => 'none', |
|---|
| 48 |
'max' => '4', |
|---|
| 49 |
'min' => '2', |
|---|
| 50 |
'values' => array( |
|---|
| 51 |
|
|---|
| 52 |
'label' => 'More patForms elements', |
|---|
| 53 |
'value' => 'w1', |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
'label' => 'Javascript validation', |
|---|
| 57 |
'value' => 'w2' |
|---|
| 58 |
), |
|---|
| 59 |
|
|---|
| 60 |
'label' => 'More Jägerschnitzel', |
|---|
| 61 |
'value' => 'w3' |
|---|
| 62 |
), |
|---|
| 63 |
|
|---|
| 64 |
'label' => 'Soft green mushroom soup on sundays', |
|---|
| 65 |
'value' => 'w4' |
|---|
| 66 |
), |
|---|
| 67 |
|
|---|
| 68 |
'label' => 'A real axe for the Argh', |
|---|
| 69 |
'value' => 'w5' |
|---|
| 70 |
), |
|---|
| 71 |
|
|---|
| 72 |
'label' => 'Roasted chicken on demand', |
|---|
| 73 |
'value' => 'w6' |
|---|
| 74 |
), |
|---|
| 75 |
|
|---|
| 76 |
'label' => 'A tank', |
|---|
| 77 |
'value' => 'w7' |
|---|
| 78 |
), |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
$form =& patForms::createForm( $elementsDefinition, array( 'name' => 'myForm' ) ); |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
$renderer =& patForms::createRenderer( "Array" ); |
|---|
| 89 |
|
|---|
| 90 |
|
|---|
| 91 |
$form->setRenderer( $renderer ); |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
$form->setAutoValidate( 'save' ); |
|---|
| 95 |
|
|---|
| 96 |
$el =& $form->getElementByName( 'wishlist' ); |
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
$elements = $form->renderForm(); |
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
if( $form->isSubmitted() ) |
|---|
| 112 |
|
|---|
| 113 |
displayErrors( $form ); |
|---|
| 114 |
} |
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
displayForm( $form, $elements ); |
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
$exampleGen->displayFooter(); |
|---|
| 124 |
?> |
|---|