So here\'s my problem. I\'m using WebView class from JavaFX in swing. The thing I want to do is that I want fields loaded in webview to be filled automatically with information
I fixed this with JavaFX webView Javascript engine. If anyone is intersted here's code snippet.
String setLastName = "document.getElementsByName('lastName')[0].value='" + lastName + "';";
String setName = "document.getElementsByName('firstName')[0].value='" + name + "'";
String setDateBirth = "document.getElementsByName('birthdate')[0].value='" + datebirth + "';";
String setPhone = "document.getElementsByName('phone')[0].value='" + phone + "';";
String setEmail = "document.getElementsByName('email')[0].value='" + email + "';";
String setPassport = "document.getElementsByName('passport')[0].value='" + passport + "';";
Button button = new Button("Fill the form");
button.setOnAction(new EventHandler() {
@Override
public void handle(ActionEvent actionEvent) {
webEngine.executeScript(setLastName);
webEngine.executeScript(setName);
webEngine.executeScript(setDateBirth);
webEngine.executeScript(setPhone);
webEngine.executeScript(setEmail);
webEngine.executeScript(setPassport);
}
});