title: Refresh Component of Parent Page on Modal Window closing
body: <p>I have a modal window, simulation JavaScript confirm box. Depending on button click i.e., cancel button or ok button I want to refresh some component of the parent page. But unfortunately it is not working. As you can see from the code, I want to set values to the two textfields to "", hide a panel and set selected option of dropdown to zero. This is not happening, the components are remaining unrefreshed.</p>
  
  <pre><code>    public class ModalConfirmWindow extends WebPage {
  
      private ModalWindow modalConfirmWindow;
      private UserAssignmentInfoPanel userAssignmentInfoPanel;
      private DropDownChoice choice;
      private TextField scheduledTimeField;
      private DateTextField deadLineField;
      private int numberOfConflictingDays;
  
      public ModalConfirmWindow(ModalWindow modalConfirmWindow, UserAssignmentInfoPanel userAssignmentInfoPanel, DropDownChoice choice, TextField scheduledTimeField, DateTextField deadLineField, int numberOfConflictingDays) {
          this.modalConfirmWindow = modalConfirmWindow;
          this.userAssignmentInfoPanel = userAssignmentInfoPanel;
          this.choice = choice;
          this.scheduledTimeField = scheduledTimeField;
          this.deadLineField = deadLineField;
          this.numberOfConflictingDays = numberOfConflictingDays;
          add(new ModalConfirmWindowForm("form"));
      }
  
      private class ModalConfirmWindowForm extends Form {
  
          private static final long serialVersionUID = 10090L;
  
          public ModalConfirmWindowForm(String id) {
              super(id);
  
              add(new Label("value", " " + numberOfConflictingDays +" ").add(new SimpleAttributeModifier("style", "color: red")));
              add(new AjaxButton("cancelButton", this) {
  
                  @Override
                  protected void onSubmit(AjaxRequestTarget target, Form form) {
                                              // I am trying to refresh the component here
                      String javaScript = "document.getElementById('"+ userAssignmentInfoPanel.getMarkupId() +"').display = 'none';" +
                                          "document.getElementById('"+ choice.getMarkupId() +"').options[0].selected = 'selected';" +
                                          "document.getElementById('"+ scheduledTimeField.getMarkupId() +"').value = \"\";" +
                                          "document.getElementById('"+ deadLineField.getMarkupId() +"').value = \"\";";                                       
                      //target.appendJavascript(javaScript);
                      //scheduledTimeField.add(new SimpleAttributeModifier("value", ""));
                      //target.addComponent(scheduledTimeField);
                      //modalConfirmWindow.close(target);
                      modalConfirmWindow.close(target);
                      target.appendJavascript(javaScript);
                  }
              });
              add(new AjaxButton("okButton", this) {
  
                  @Override
                  protected void onSubmit(AjaxRequestTarget target, Form form) {
                      modalConfirmWindow.close(target);
                  }
              });
          }
  
      }
  }
  </code></pre>
  
  <p>How can I do this?</p>