Index: trunk/phase3/includes/HTMLForm.php |
— | — | @@ -1444,7 +1444,7 @@ |
1445 | 1445 | $attribs + $thisAttribs ); |
1446 | 1446 | $checkbox .= ' ' . Html::rawElement( 'label', array( 'for' => "{$this->mID}-$info" ), $label ); |
1447 | 1447 | |
1448 | | - $html .= $checkbox . '<br />'; |
| 1448 | + $html .= Html::rawElement( 'div', array( 'class' => 'mw-htmlform-multiselect-item' ), $checkbox ); |
1449 | 1449 | } |
1450 | 1450 | } |
1451 | 1451 | |
— | — | @@ -1452,17 +1452,22 @@ |
1453 | 1453 | } |
1454 | 1454 | |
1455 | 1455 | function loadDataFromRequest( $request ) { |
1456 | | - # won't work with getCheck |
1457 | | - if ( $request->getCheck( 'wpEditToken' ) ) { |
1458 | | - $arr = $request->getArray( $this->mName ); |
1459 | | - |
1460 | | - if ( !$arr ) { |
1461 | | - $arr = array(); |
| 1456 | + if ( $this->mParent->getMethod() == 'post' ) { |
| 1457 | + if( $request->wasPosted() ){ |
| 1458 | + # Checkboxes are just not added to the request arrays if they're not checked, |
| 1459 | + # so it's perfectly possible for there not to be an entry at all |
| 1460 | + return $request->getArray( $this->mName, array() ); |
| 1461 | + } else { |
| 1462 | + # That's ok, the user has not yet submitted the form, so show the defaults |
| 1463 | + return $this->getDefault(); |
1462 | 1464 | } |
1463 | | - |
1464 | | - return $arr; |
1465 | 1465 | } else { |
1466 | | - return $this->getDefault(); |
| 1466 | + # This is the impossible case: if we look at $_GET and see no data for our |
| 1467 | + # field, is it because the user has not yet submitted the form, or that they |
| 1468 | + # have submitted it with all the options unchecked? We will have to assume the |
| 1469 | + # latter, which basically means that you can't specify 'positive' defaults |
| 1470 | + # for GET forms. FIXME... |
| 1471 | + return $request->getArray( $this->mName, array() ); |
1467 | 1472 | } |
1468 | 1473 | } |
1469 | 1474 | |