Marko Asplund wrote:
hi

I need to do the following in my JSF application:
- submit a form with input text fields
- validate form input
- if conversion or validation results in errors, show the original form
- if input is ok, open a new window and load a JSF response in it.
Input form window is left unchanged.

One option I can come up with would be to include a piece of
Javascript in the form page on postback that would open up a new
window and load the JSF view in it. Does this sound workable? How do I
generate Javascript code that would result in invoking a JSF action
method in a browser window?

How about:
  <t:div rendered="#{pageBean.showPopup}">
    <f:verbatim>
      <script type="text/javascript">
        window.open("/popup.jsf", "popupwin", "....");
      </script>
    </f:verbatim>
  </t:div>

Then in your method that is connected to the commandButton used to submit the page, just set a flag so that showPopup returns true.

The flag will be false initially, so the script won't render. After a successful submit, showPopup will return true so the script is rendered and the window will open.

Regards,

Simon

Reply via email to