Saturday, March 10, 2012

Opening ADF PopUp on Page Load

You may have requirement to capture user parameters, before navigating to actual page. This can be implemented by opening ADF popup during page load. User provides required information and confirms it by closing popup - actual page is rendered based on dialog action.

Sample application - IntroPopUpApp.zip, is implemented based on following process:


With ADF Faces its pretty easy to open user friendly popup on page load. All what developer needs to do is to define af:showPopupBehavior operation for af:document tag:


af:showPopupBehavior trigger type should be set to load. This will ensure, it will be executed during document load and will call popup during page rendering phase:


PopUp is rendered on page load:


Such functionality can be very useful, when we need to set bind variable value for VO, based on user input. Instead of building separate data entry page, we can handle user data entry from on-load popup.

12 comments:

  1. Thanks for the info.. Never know this simple shortcut.. We used to put in page phase listener.

    ReplyDelete
  2. Thanks for the tip. Now I know how to do it in case I need to implement this. :)

    ReplyDelete
  3. thank you for this post!! I really appreciateyour blog! Thank you for your work!

    ReplyDelete
  4. Trigger type load is available only on jspx

    How do i achieve this for a jsff ?
    I need to show the popup when jsff inside bounded taskflow is loaded

    ReplyDelete
  5. Hi,

    Unfortunately there is no such quick hint for JSF Fragment. I plan to post solution for this - on my todo list.

    Andrejus

    ReplyDelete
  6. Andrejus

    have you figured out how to launch the popup in jsff?

    We are trying to work wround with javascript and jQuery. Of course, it's painful.

    So far we managed to store the JS script in JSFF, and use clientListener from JSPX to launch the popup. However, we have to launch it based on some backing bean calculation. It remains a pain.

    ReplyDelete
  7. @sam

    I am not answering on behalf of Andrejus, but can suggest a simple approach.

    Create a input text on jsff
    Set the visible to false for that text
    Bind the input text to bean
    In the getter for that text, show your popup programmatically

    Hope this helps.

    Jaspal

    ReplyDelete
  8. Jaspal - thanks for helping on this.

    Andrejus

    ReplyDelete
  9. Hi,
    Thanks for this nice tip. Its really helpful.

    Is there any approach for opening ADF popup during jsff page load to capture user parameters.?

    I tried the approach mentioned by Mr.Jaspal . But it didn't work for me.

    Gijith.

    ReplyDelete
  10. Hi Andrejus,

    Thank you so much for you post.
    All of your post is very effective and helpful in real time application.
    As a follower of your blog currently I am facing a new problem.

    I want to open a pop up on jsff page load.I know how to do that. It's working when i placed the task flow in a region on main page.
    But it's not working on Dynamic region.
    Could you please guide me to resolve this problem.
    Thanks in advance !
    Tanmoy

    ReplyDelete
  11. This is a good question. I will plan a new blog post to answer it.

    Regards,
    Andrejus

    ReplyDelete