Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc |
— | — | @@ -63,6 +63,10 @@ |
64 | 64 | return $javascript_text; |
65 | 65 | } |
66 | 66 | |
| 67 | + /** |
| 68 | + * All the Javascript calls to validate both the type of each |
| 69 | + * form field and their presence, for mandatory fields |
| 70 | + */ |
67 | 71 | static function validationJavascript() { |
68 | 72 | global $sfgJSValidationCalls; |
69 | 73 | |
— | — | @@ -394,6 +398,39 @@ |
395 | 399 | return $text; |
396 | 400 | } |
397 | 401 | |
| 402 | + /** |
| 403 | + * Add a hidden input for each field in the template call that's |
| 404 | + * not handled by the form itself |
| 405 | + */ |
| 406 | + static function unhandledFieldsHTML($template_contents) { |
| 407 | + $text = ""; |
| 408 | + foreach ($template_contents as $key => $value) { |
| 409 | + if ($key != '' && !is_numeric($key)) { |
| 410 | + $text .=<<<END |
| 411 | + <input type="hidden" name="_unhandled_$key" value="$value" /> |
| 412 | + |
| 413 | +END; |
| 414 | + } |
| 415 | + } |
| 416 | + return $text; |
| 417 | + } |
| 418 | + |
| 419 | + /** |
| 420 | + * Add unhandled fields back into the template call that the form |
| 421 | + * generates, so that editing with a form will have no effect on them |
| 422 | + */ |
| 423 | + static function addUnhandledFields() { |
| 424 | + global $wgRequest; |
| 425 | + $additional_template_text = ""; |
| 426 | + foreach ($wgRequest->getValues() as $key => $value) { |
| 427 | + if (substr($key, 0, 11) == '_unhandled_') { |
| 428 | + $field_name = substr($key, 11); |
| 429 | + $additional_template_text .= "|$field_name=$value\n"; |
| 430 | + } |
| 431 | + } |
| 432 | + return $additional_template_text; |
| 433 | + } |
| 434 | + |
398 | 435 | static function summaryInputHTML($is_disabled, $label = null) { |
399 | 436 | global $sfgTabIndex; |
400 | 437 | |