Index: trunk/extensions/CongressLookup/CongressLookup.i18n.php |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | 'congresslookup-no-house-rep' => 'No House representative was found for your zip code.', |
26 | 26 | 'congresslookup-no-senators' => 'No senators were found for your zip code.', |
27 | 27 | 'congresslookup-report-errors' => 'Report an error', |
| 28 | + 'congresslookup-zipcode-error' => 'Please enter your zipcode in the format "12345" or "12345-1234".', |
28 | 29 | ); |
29 | 30 | |
30 | 31 | /** Message documentation (Message documentation) |
— | — | @@ -42,4 +43,5 @@ |
43 | 44 | 'congresslookup-no-house-rep' => 'Error message for when no House representative is found', |
44 | 45 | 'congresslookup-no-senators' => 'Error message for when no Senators are found', |
45 | 46 | 'congresslookup-report-errors' => 'Label for a link to the error reporting page', |
| 47 | + 'congresslookup-zipcode-error' => 'Error message for when an invalid zip code is entered to the form.', |
46 | 48 | ); |
Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php |
— | — | @@ -19,8 +19,9 @@ |
20 | 20 | global $wgRequest, $wgOut; |
21 | 21 | |
22 | 22 | // Pull in query string parameters |
23 | | - $this->setZip( $wgRequest->getVal( 'zip' )); |
24 | | - |
| 23 | + $zip = $wgRequest->getVal( 'zip' ); |
| 24 | + if ( !is_null( $zip )) $this->setZip( $zip ); |
| 25 | + |
25 | 26 | // Setup |
26 | 27 | $wgOut->disable(); |
27 | 28 | $this->sendHeaders(); |
— | — | @@ -116,6 +117,7 @@ |
117 | 118 | margin-bottom: 1em; |
118 | 119 | } |
119 | 120 | p.error { |
| 121 | + color: red; |
120 | 122 | } |
121 | 123 | </style> |
122 | 124 | </head> |
— | — | @@ -276,6 +278,11 @@ |
277 | 279 | $htmlOut = <<<HTML |
278 | 280 | <h4>Contact your representatives</h4> |
279 | 281 | <div class="sopaActionDiv"> |
| 282 | +HTML; |
| 283 | + if ( $isError ) { |
| 284 | + $htmlOut .= Html::element( 'p', array( 'class' => 'error' ), wfMsg( 'congresslookup-zipcode-error' )); |
| 285 | + } |
| 286 | + $htmlOut .= <<<HTML |
280 | 287 | <form action="" method="GET"> |
281 | 288 | <label for="zip">Your zip code:</label> |
282 | 289 | <input type="text" maxlength="10" size="5" name="zip" id="zip"/> |