| Index: trunk/extensions/ApiSandbox/SpecialApiSandbox.php |
| — | — | @@ -32,7 +32,8 @@ |
| 33 | 33 | $out->addHTML( '<noscript>' . wfMessage( 'apisb-no-js' )->parse() . '</noscript> |
| 34 | 34 | <div id="api-sandbox-content" style="display: none">' ); |
| 35 | 35 | $out->addWikiMsg( 'apisb-intro' ); |
| 36 | | - $out->addHTML( $this->openFieldset( 'parameters' ) |
| | 36 | + $out->addHTML( '<form id="api-sandbox-form">' |
| | 37 | + . $this->openFieldset( 'parameters' ) |
| 37 | 38 | . $this->getInputs() |
| 38 | 39 | . '</fieldset>' |
| 39 | 40 | . $this->openFieldset( 'result' ) |
| — | — | @@ -48,7 +49,7 @@ |
| 49 | 50 | ' |
| 50 | 51 | . '<tr><td colspan="2"><div id="api-sandbox-output"></div></td></tr>' |
| 51 | 52 | . "\n</tbody></table>" |
| 52 | | - . "\n</fieldset>" ); |
| | 53 | + . "\n</fieldset>\n</form>" ); |
| 53 | 54 | |
| 54 | 55 | $out->addHTML( "\n</div>" ); # <div id="api-sandbox-content"> |
| 55 | 56 | } |
| — | — | @@ -103,7 +104,7 @@ |
| 104 | 105 | |
| 105 | 106 | $s .= Html::element( 'input', |
| 106 | 107 | array( |
| 107 | | - 'type' => 'button', |
| | 108 | + 'type' => 'submit', |
| 108 | 109 | 'id' => 'api-sandbox-submit', |
| 109 | 110 | 'value' => wfMessage( 'apisb-submit' )->text(), |
| 110 | 111 | 'disabled' => 'disabled', |
| Index: trunk/extensions/ApiSandbox/ext.apiSandbox.js |
| — | — | @@ -225,7 +225,12 @@ |
| 226 | 226 | } |
| 227 | 227 | } ); |
| 228 | 228 | |
| 229 | | - $submit.click( function() { |
| | 229 | + |
| | 230 | + $( '#api-sandbox-form' ).submit( function( e ) { |
| | 231 | + e.preventDefault(); |
| | 232 | + if ( !$submit.is( ':enabled' ) ) { |
| | 233 | + return; |
| | 234 | + } |
| 230 | 235 | var url = mw.util.wikiScript( 'api' ) + '?action=' + $action.val(), |
| 231 | 236 | params = mainRequest.getRequestData(), |
| 232 | 237 | mustBePosted = isset( mainRequest.info.mustbeposted ); |