Index: trunk/extensions/Wikidata/OmegaWiki/forms.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | |
15 | 15 | function getTextArea( $name, $text = "", $rows = 5, $columns = 80, $disabled = false ) { |
16 | 16 | if ( $disabled ) { |
17 | | - return '<textarea disabled="disabled" name="' . $name . '" rows="' . $rows . '" cols="' . $columns . '">' . htmlspecialchars( $text ) . '</textarea>'; |
| 17 | + return '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $columns . '" READONLY>' . htmlspecialchars( $text ) . '</textarea>'; |
18 | 18 | } else { |
19 | 19 | return '<textarea name="' . $name . '" rows="' . $rows . '" cols="' . $columns . '">' . htmlspecialchars( $text ) . '</textarea>'; |
20 | 20 | } |
— | — | @@ -27,11 +27,10 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | function getCheckBox( $name, $isChecked, $disabled = false ) { |
31 | | -// FIXME: if disabled is activated, then the page cannot be saved... why? |
32 | | -// this affects identical_meaning checkboxes, but not delete_checkboxes |
33 | | -// workaround : disable the checkbox with java instead of html "disabled" |
| 31 | + // a disabled checkbox returns no value, as if unchecked |
| 32 | + // therefore the value of a disabled, but checked, checkbox must be sent with a hidden input |
34 | 33 | if ( $disabled ) { |
35 | | - return '<input type="checkbox" name="' . $name . '"' . checkBoxCheckAttribute( $isChecked ) . ' onClick="this.checked = ! this.checked ;"/>'; |
| 34 | + return '<input disabled="disabled" type="checkbox" name="' . $name . checkBoxCheckAttribute( $isChecked ) . '/><input type="hidden" name="' . $name . '" value="' . $isChecked . '"/>'; |
36 | 35 | } else { |
37 | 36 | return '<input type="checkbox" name="' . $name . '"' . checkBoxCheckAttribute( $isChecked ) . '/>'; |
38 | 37 | } |
— | — | @@ -39,7 +38,7 @@ |
40 | 39 | |
41 | 40 | function getCheckBoxWithOnClick( $name, $isChecked, $onClick, $disabled = false ) { |
42 | 41 | if ( $disabled ) { |
43 | | - return '<input disabled="disabled" type="checkbox" name="' . $name . '"' . checkBoxCheckAttribute( $isChecked ) . ' onclick="' . $onClick . '"/>'; |
| 42 | + return '<input disabled="disabled" type="checkbox" name="' . $name . '"' . checkBoxCheckAttribute( $isChecked ) . '"/><input type="hidden" name="' . $name . '" value="' . $isChecked . '"/>'; |
44 | 43 | } else { |
45 | 44 | return '<input type="checkbox" name="' . $name . '"' . checkBoxCheckAttribute( $isChecked ) . ' onclick="' . $onClick . '"/>'; |
46 | 45 | } |