| @@ 127-160 (lines=34) @@ | ||
| 124 | * |
|
| 125 | * @return boolean true if okey, false if something went wrong. |
|
| 126 | */ |
|
| 127 | public function callbackSubmit() |
|
| 128 | { |
|
| 129 | // These return a single value |
|
| 130 | // Type checkbox returns true if checked |
|
| 131 | $elements = [ |
|
| 132 | "text", "password", "hidden", "file", "textarea", "select", |
|
| 133 | "radio", "checkbox", |
|
| 134 | ]; |
|
| 135 | foreach ($elements as $name) { |
|
| 136 | $this->form->addOutput( |
|
| 137 | "$name has value: " |
|
| 138 | . $this->form->value($name) |
|
| 139 | . "</br>" |
|
| 140 | ); |
|
| 141 | } |
|
| 142 | ||
| 143 | // Select multiple returns an array |
|
| 144 | $elements = [ |
|
| 145 | "selectm", |
|
| 146 | ]; |
|
| 147 | foreach ($elements as $name) { |
|
| 148 | $this->form->addOutput( |
|
| 149 | "$name has value: " |
|
| 150 | . implode($this->form->value($name), ", ") |
|
| 151 | . "</br>" |
|
| 152 | ); |
|
| 153 | } |
|
| 154 | ||
| 155 | // Remember values during resubmit, useful when failing (retunr false) |
|
| 156 | // and asking the user to resubmit the form. |
|
| 157 | $this->form->rememberValues(); |
|
| 158 | ||
| 159 | return true; |
|
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| @@ 136-172 (lines=37) @@ | ||
| 133 | * |
|
| 134 | * @return boolean true if okey, false if something went wrong. |
|
| 135 | */ |
|
| 136 | public function callbackSubmit() |
|
| 137 | { |
|
| 138 | // These return a single value |
|
| 139 | // Type checkbox returns true if checked |
|
| 140 | $elements = [ |
|
| 141 | "text", "password", "hidden", "file", "textarea", "select", |
|
| 142 | "radio", "checkbox", |
|
| 143 | ]; |
|
| 144 | foreach ($elements as $name) { |
|
| 145 | $this->form->addOutput( |
|
| 146 | "$name has value: " |
|
| 147 | . $this->form->value($name) |
|
| 148 | . "</br>" |
|
| 149 | ); |
|
| 150 | } |
|
| 151 | ||
| 152 | // Select multiple returns an array |
|
| 153 | $elements = [ |
|
| 154 | "selectm", |
|
| 155 | ]; |
|
| 156 | foreach ($elements as $name) { |
|
| 157 | $this->form->addOutput( |
|
| 158 | "$name has value: " |
|
| 159 | . implode($this->form->value($name), ", ") |
|
| 160 | . "</br>" |
|
| 161 | ); |
|
| 162 | } |
|
| 163 | ||
| 164 | // Set <output> class |
|
| 165 | $this->form->setOutputClass("info"); |
|
| 166 | ||
| 167 | // Remember values during resubmit, useful when failing (retunr false) |
|
| 168 | // and asking the user to resubmit the form. |
|
| 169 | $this->form->rememberValues(); |
|
| 170 | ||
| 171 | return true; |
|
| 172 | } |
|
| 173 | } |
|
| 174 | ||