Resets this form to its initial values, returning the page contained by this form's window after the reset. Note that the returned page may or may not be the same as the original page, based on JavaScript event handlers, etc. @return the page contained by this form's window after the reset
()
| 420 | * @return the page contained by this form's window after the reset |
| 421 | */ |
| 422 | public Page reset() { |
| 423 | final SgmlPage sgmlPage = getPage(); |
| 424 | final ScriptResult scriptResult = fireEvent(Event.TYPE_RESET); |
| 425 | if (ScriptResult.isFalse(scriptResult)) { |
| 426 | return sgmlPage.getWebClient().getCurrentWindow().getEnclosedPage(); |
| 427 | } |
| 428 | |
| 429 | for (final HtmlElement next : getHtmlElementDescendants()) { |
| 430 | if (next instanceof SubmittableElement element) { |
| 431 | element.reset(); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | return sgmlPage; |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * {@inheritDoc} |
no test coverage detected