Search in sources :

Example 1 with HTMLFormElement

use of org.w3c.dom.html.HTMLFormElement in project intellij-plugins by StepicOrg.

the class StudyBrowserWindow method loadContent.

void loadContent(@NotNull String template, @NotNull Map<String, Object> params) {
    String content = getContent(template, params);
    Platform.runLater(() -> {
        Document document = engine.getDocument();
        if (document != null) {
            HTMLFormElement form = (HTMLFormElement) document.getElementById("answer_form");
            if (form != null) {
                HTMLInputElement action = (HTMLInputElement) form.getElements().namedItem("action");
                action.setValue("save_reply");
                FormListener.handle(project, this, form);
            }
        }
        engine.loadContent(content);
    });
}
Also used : HTMLFormElement(org.w3c.dom.html.HTMLFormElement) HTMLInputElement(org.w3c.dom.html.HTMLInputElement) Document(org.w3c.dom.Document)

Example 2 with HTMLFormElement

use of org.w3c.dom.html.HTMLFormElement in project intellij-plugins by StepicOrg.

the class FormListener method handleEvent.

@Override
public void handleEvent(Event event) {
    String domEventType = event.getType();
    if (EVENT_TYPE_SUBMIT.equals(domEventType)) {
        HTMLFormElement form = (HTMLFormElement) event.getTarget();
        handle(project, browser, form);
        event.preventDefault();
        event.stopPropagation();
    }
}
Also used : HTMLFormElement(org.w3c.dom.html.HTMLFormElement)

Aggregations

HTMLFormElement (org.w3c.dom.html.HTMLFormElement)2 Document (org.w3c.dom.Document)1 HTMLInputElement (org.w3c.dom.html.HTMLInputElement)1