ADF Dialog Framework Cancel Button

Hi all,
We're experiencing, in multiple applications, a problem with a Cancel button (immediate="true") on a page launched by the dialog framework. While the value does not change in the model layer (saving to the database confirms this), it does seem to appear in the application UI, even after clicking the cancel button, until you post data.
Details follow:
This code is all JHS-generated, but we've spoken to Steven Davelaar, and he's pretty sure it's not a JHS problem. I certainly can't see anything obviously wrong with the code.
Here's the component that launches the dialog, minus attributes like "rows" and "columns":
<af:panelLabelAndMessage label="MIS Notes: "
    id="RpReportDocHeaderVwMisNotesLabel">
    <af:inputText id="SomeAttr" value="#{bindings.SomeAttr.inputValue}"
        required="#{bindings.SomeAttr.mandatory}"
        simple="true" partialTriggers="SomeAttrEditorLink"
        binding="#{SomeAttrEditorItem.editorItem}">
    </af:inputText> 
    <f:facet name="end">
        <af:commandLink id="SomeAttrEditorLink"
            action="dialog:editor" immediate="true" useWindow="true"                           
            partialSubmit="true" windowHeight="320" windowWidth="670"
            returnListener="#{SomeAttrEditorItem.returnedFromEditor}"
            launchListener="#{SomeAttrEditorItem.launchEditor}">
            <af:objectImage source="/jheadstart/images/editor.gif"/>
        </af:commandLink>
    </f:facet>
</af:panelLabelAndMessage />The editor window, minus layout, form, etc. elements, is as follows:
<af:inputText rows="10" columns="100"
    value="#{processScope.editorValue}"
    maximumLength=
        "#{processScope.editorMaxLength==0 ? null : processScope.editorMaxLength}" />
<af:panelButtonBar>
    <af:commandButton text="Cancel" immediate="true">
        <af:returnActionListener/>
    </af:commandButton>
    <af:commandButton text="OK">
        <af:returnActionListener value="#{processScope.editorValue}"/>
    </af:commandButton>
</af:panelButtonBar>Now, SomeAttrEditorItem is a managed bean of type oracle.jheadstart.controller.jsf.bean.EditorItemBean, so it's JHS code, but nothing about it should really matter if the returnActionListener for the Cancel button doesn't contain a value and is immediate, should it?
Any help much appreciated. Thanks much,
Avrom

Thanks, Frank. This looks like a JHS bug (albeit one we can work around by writing our own template)--JHS should probably not be generating code that leaves cancelled changes in place. I'll notify them on their forum.
[Edit:] Actually, there's something I don't understand about the instructions. In a case like this, I really only want to undo changes to a particular attribute--whatever attribute the dialog changed. And ideally, I don't want to refresh to the last pre-commit point; I want to just discard the changes that were made by this particular dialog. So I don't really think Row.refresh() is going to work here.
Now, I could do something like this: In the launch listener, store the relevant attribute in some transient location, and on return, refresh it. But that seems overly complicated; isn't there a way to just not submit a dialog's values upon returning to the original form, or, at least, to prevent them from updating the model?
Message was edited by:
Avrom
[Further edit:] Wait, no, there's something even stranger going on here. Note that the text input in the dialog isn't bound to "#{bindings.SomeAttr.inputValue}"; it's bound to "#{processScope.editorValue}". And the cancel button doesn't even have a returnActionListener! So how is the value getting passed back to the original form?
Message was edited by:
Avrom

Similar Messages

  • ADF dialog framework problem

    I am using the "old" dialog framework in ADF 11G.
    I create two pages. One page "pops" the other with dialog:page2 and usewindow.
    This works fine when i create a simple web project.
    But when i create the same code in a ADF ViewController project the second window opens in the same window as the first one.
    Is this a bug?
    Johnny

    Hi Frank,
    This will show you my problem:
    1. create new application
    2. choice fusion web application
    3. press finish
    4. created JSF page main:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:form>
    <af:commandButton useWindow="true" action="dialog:popup" text="commandButton 1"/>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    5. created JSF page popup:
    <?xml version='1.0' encoding='windows-1252'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <af:form>
    <af:outputText value="outputText1"/>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    6. create Faces navigation rule:
    <?xml version="1.0" encoding="windows-1252"?>
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
    <application>
    <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
    </application>
    <navigation-rule>
    <navigation-case>
    <from-outcome>dialog:popup</from-outcome>
    <to-view-id>/popup.jspx</to-view-id>
    </navigation-case>
    </navigation-rule>
    </faces-config>
    7. run the main page
    8. using ie 7 the main page shows
    9. push the button: no pupup, instead the "popup-page opens in same window as my main page
    Can I mail you the project, somehow?

  • Af:dialog model-restore / cancel-button processing best practice ?

    Using JDev 11.1.1.3; if I have an af:dialog running in an af:popup which contains auto-submit components (for cross-component enablement, validation etc.). My question is what are the preferred ways of discarding the model submitted changes made through popup processing if/when the af:dialog cancel button is pressed by user ? Figured that using a task flow for the content that is the popup could be an option, and using the task flow savepoint restore feature, but that looks more like database restore than model restore. I want to be able to restore the model content to the way it looked before the popup executed, without necessitating a submit to the database. How is this most commonly and best achieved ?
    Thanks,

    Taskflow savepoints are not database savepoints. Transactional BTF can be configured to issue automatic savepoints at TF entry and eventually to "rollback" to them at the TF exit. The internal implementation uses the ApplicationModule's passivation/activation mechanism to passivate the AM state at the TF entry and eventually to activate the AM state at the TF exit back to the passivated state at the entry. In this way it is simulated that you have not made any modifications in ADF BC, so your model layer will be restored to the state before TF entry. (Of course, you must not perform any DB commits durring the lifetime of this TF). I have used successfully this mechanism for the same goal you are asking about.
    Also there are savepoints managed by the ADF Controller, but I could be of little help here because I have never used them. I suspect that this mechanism could be what you need, so you may have a look here for more details:
    Adding Save Points to a Task Flow
    and in this thread:
    {thread:id=2128956}
    Dimitar

  • ADF Faces: dialog framework calls  twice prepareModel and prepareRender

    Hi ,
    does anybody know why ADF Faces dialog framework calls twice prepareModel and prepareRender lifecycle methods . That's a really problem for me because i'm calling db procedures through backing beans methods which are attached on components properties.
    I cannot allow myself to cal the procedures more than once.
    Can somebody help me?
    Krasi

    Okay, although the servlet doesn't require to be run inside the JSF context, I added "/faces" to the URL simply because this would allow me to query the "postback" flag. In other words, I changed the invocation URL from "/jrrun" to "/faces/jrrun".
    In the servlet's "service()" method I put:
    logger.debug(">>>>>> isPostBack? " + AdfFacesContext.getCurrentInstance().isPostback());
    I also attached a JSF PhaseListener to the whole thing.
    Then I opened the parent page, I clicked on the button and the dialog appeared. The console output follows:
    07/01/19 21:37:05 ------------- start of phase RESTORE_VIEW 1
    07/01/19 21:37:05 ------------- end of phase RESTORE_VIEW 1
    07/01/19 21:37:05 ------------- start of phase RENDER_RESPONSE 6
    2007-01-19 21:37:05,156 - DEBUG - >>>>>> RunJasperReport: beginning
    2007-01-19 21:37:05,156 - DEBUG - >>>>>> isPostBack? false
    2007-01-19 21:37:05,156 - DEBUG - >>>>>> RunJasperReport: repPath=/reports/newRegByBusType_Report.jasper
    2007-01-19 21:37:07,047 - DEBUG - >>>>>> RunJasperReport: report output (PDF) was generated successfully. Its total size is 59596 bytes.
    2007-01-19 21:37:07,047 - DEBUG - >>>>>> RunJasperReport: done
    07/01/19 21:37:07 ------------- end of phase RENDER_RESPONSE 6
    07/01/19 21:37:09 ------------- start of phase RESTORE_VIEW 1
    07/01/19 21:37:09 ------------- end of phase RESTORE_VIEW 1
    07/01/19 21:37:09 ------------- start of phase RENDER_RESPONSE 6
    2007-01-19 21:37:09,625 - DEBUG - >>>>>> RunJasperReport: beginning
    2007-01-19 21:37:09,625 - DEBUG - >>>>>> isPostBack? false
    2007-01-19 21:37:09,625 - DEBUG - >>>>>> RunJasperReport: repPath=/reports/newRegByBusType_Report.jasper
    2007-01-19 21:37:09,672 - DEBUG - >>>>>> RunJasperReport: report output (PDF) was generated successfully. Its total size is 59596 bytes.
    2007-01-19 21:37:09,688 - DEBUG - >>>>>> RunJasperReport: done
    07/01/19 21:37:09 ------------- end of phase RENDER_RESPONSE 6
    By the way, partialSubmit="true" has the same effect as partialSubmit="false".
    I'm not sure I understand you correctly. Or perhaps you don't understand me correctly.
    I haven't got a problem with the parent page. I have a problem with the dialog page. It's executed twice. The RENDER_RESPONSE phase (as well as the RESTORE_VIEW phase) is executed twice.
    I want it to be executed only once. I don't want the servlet to be executed twice.
    Let me point out again that in the Embedded OC4J (inside JDeveloper) everything is okay. The servlet is executed only once. However, the same thing on OAS 10.1.3.1 runs twice.

  • ADF Faces: PPR and Dialog framework

    Hi All,
    I know that there have been some navigation-related issues reported with 10.1.3 and the dialog framework, so if this is a bug.....
    Anyway, I have an ADF Faces page that displays some data (from ADF View Object) in an af:Table. I have an "Edit Record" button and a "Create Record" button in the appropriate facets of the table. The 2 buttons use a dialog: navigation case (useWindow=true) to open a pop-up window with a record displayed for editing. Each of the buttons also has partialSubmit=true with an appropriate ID set on the button.
    Now, I am trying to get the table to refresh upon return from the dialog. After much experimentation, I have found that setting the partialTriggers property on the af:OutputText components that are inside the af:Table->af:Column will cause an existing row to refresh upon return from the edit button. However, I cannot get a new row to show up inside of the table upon return from the create button. I have tried setting partial triggers on the af:OutputText, af:Column, af:Table, etc all the way up to the top-level af:Page to no avail. I have also tried refreshing the iterator binding in the dialog return, to no avail. If I completely refresh the page (see sample code below), the record does show up, but it does cause other undesirable side effects (screen scrolls to the top, af:showDetailHeader's re-set their state, etc).
    Any pointers are appreciated...
    Here is the code behind my create button:
      public String performCreateCheck()
        DCBindingContainer bindings = getBindings();
        OperationBinding operationBinding = bindings.getOperationBinding("CreateNewCheck");
        Object result = operationBinding.execute();
        // Stuff snipped - the CreateNewCheck binding does a "CreateInsert" on my VO
        return "dialog:EditCheck";
      }Here is the code that refreshes the page (causes the new row to appear):
      protected void refreshCurrentPage()
        FacesContext context = FacesContext.getCurrentInstance();
        String currentView = context.getViewRoot().getViewId();
        ViewHandler vh = context.getApplication().getViewHandler();
        UIViewRoot x = vh.createView(context, currentView);
        x.setViewId(currentView);
        context.setViewRoot(x);
      }Kind regards,
    John

    Found this: http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#81
    on Steve M's blog. His example uses exactly the same method that I do. However, It would be nice to get this working "properly" with PPR instead of refreshing the whole page. Here are what I see as the drawbacks to the "refresh the whole page" method:
    1). The page will scroll up to the top. If the page is bigger than a screenful, this is an annoyance.
    2). Any af:showDetailHeader's will have their disclosed property reset (unless you implement some method of saving their state). This is an issue for me, as the af:Table is inside of a normally un-disclosed af:showDetailHeader
    3). If any component anywhere puts something into the faces messages (e.g. "Record saved"), it will be lost when the page is refreshed.
    Any ideas on how to get this working with PPR?
    Regards,
    John

  • Creating a dialog box with OK and Cancel buttons without OADialogPage

    Hi Experts,
    i want to create a dialog box for Delete Confirmation means after clicking on delete it should pop up a small dialog box with OK/Cancel buttons
    and need code for the same to handle the buttons.
    i have created with OADialogPage but its showing in a complete page but i want to show those buttons in a small box.
    Plz help.
    THANKS IN ADVANCE.
    Thanks
    Raja.

    Hi,
    I have not tried using javascript in destination URI as suggested by Mukul.
    I have tried the below code for opening a page as dialog box.
    You can try it for your requirement by creating a dialog page of your own, say XXDialogPage (with OK and Cancel button)
    StringBuffer l_buffer = new StringBuffer();
    l_buffer.append("javascript:mywin = openWindow(top, '");
    String url = "/OA_HTML/OA.jsp?page=/xx/oracle/apps/fnd/dialog/webui/OADialogPG";
    OAUrl popupUrl = new OAUrl(url, OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE );
    String strUrl = popupUrl.createURL(pageContext);
    l_buffer.append(strUrl.toString());
    l_buffer.append("', 'lovWindow', {width:500, height:500},false,'dialog',null);");
    pageContext.putJavaScriptFunction("SomeName",l_buffer.toString());
    In dialog page's controller, you can forward it to the page onc ethe user selects OK or Cancel.
    Pass the selected value back to the main page and further you can use it for deleting.
    Regards.

  • Can ADF Faces Dialog Framework be used in a Bounded Task Flow ?

    Jdev. 11.1.1.4
    I have read chapter "19 Using Dialogs in Your Application" in the Jdev documentation.
    There explains that there are mainly two methods to open dialogs in ADF:
    The first (point 19.2) is calling a bounded task flow from a view activity (for example). This system can only open modal windows.
    The other is using the ADF Faces Dialog Framework and it seems to be more general. In point "19.3.1 How to Define a JSF Navigation Rule for Opening a Dialog" it is explainied the way to achieve this but the explanation begins with "In the adfc-config.xml file, create a page flow for".
    does this mean that I can not use this technology inside a Bounded task flow ?
    I have tried and it seems that it doesn't work.
    Currently we are using af:showpopupbehaviour to open popups, but this doesn't work with task flows and I don't like this.

    does this mean that I can not use this technology inside a Bounded task flow ?ADF Faces Dialog Framework can be used in both unbounded and bounded taskflows.
    I have tried and it seems that it doesn't work.The command commponent outcome must begin with "dialog:" and the command component tag must have useWindow="true", for example:
    <tt><af:commandButton action="dialog:toEdit" useWindow="true" .../></tt>
    Currently we are using af:showpopupbehaviour to open popups<af:showPopupBehaviour> can be used to open inline popups, but it has nothing to do with the Dialog Framework. Inline popups and the dialogs of the Dialog Framework are two different things.
    Dimitar
    Edited by: Dimitar Dimitrov on Jul 27, 2012 3:33 PM

  • Input dialog question OK/Cancel Button

    Hi there,
    I�m busy with an application that displays an input dialog box on start up. It prompts the user for their name. This imput will then be used for a JLabel welcoming the user with their name. If no name is entered. The Jlabel will display �Welcone User�. Everythng works fine but when I press cancel on the input dialog box I get an error. Below is some code of what I�ve done so far.
    Thanks,
    Patrick.
    String name = JOptionPane.showInputDialog(null,
              "Please enter your name",
              "Name input",
              JOptionPane.PLAIN_MESSAGE);
              welcome = new JLabel(name);
              if (name.length() == 0) {
                   welcome = new JLabel("Welcome User");
              else if (name.length() > 0) {
                   welcome = new JLabel("Welcome " + name);

    The error is NullPointerException.
    If the cancel button is pushed a null is returned.
    Try this test instead
    if ((name == null) || (name.length() == 0))
       welcome = new JLabel("Welcome User");
    }

  • Listener for cancel button of dialog

    Hi
         What shud i add as listener for the dialog , so that when i press cancel button the listener shud get executed?. Alos is there any listener to know if the user has pressed the close(x) mark of the dialog and closed the dialog. Any help wud be appreciable
    Thanks
    Veena

    try beforesubmit handler
    Ref:
    http://dev.day.com/docs/en/cq/current/widgets-api/index.html?class=CQ.Dialog

  • How to skip validations in ADF on click of cancel button

    Hi,
    I am new to this technology. i Have used ADF components required property to do Required filed validations. Whne i click on Cancel button i dont want the validations to get executed. How to skip validations in ths case?
    I am using ADF 11g and JSF 2.2

    Set immediate property of the cancel button to true.
    Check this out.
    http://jobinesh.blogspot.com/2009/08/how-to-skip-validation.html
    -Arun

  • Cancel button to display confirmation dialog in an edittable form

    Hi everyone.
    I have got a requirement that in my edittable form, I need to show confirmation popup before canelling the page and discarding all the changes.
    But, before showing that dialog, I need to figure out if any changes happened or not?
    As usual, my cancel button is set to immediate=true, and for that reason, I couldn't find any way to see whether user done any change or not.
    As far as I know, there are two ways to find out the changes:
    1. using Data control
            ApplicationModule am = ADFUtils.getDCBindingContainer().getDataControl().getApplicationModule();
            return am.getTransaction().isDirty();
         OR
            BindingContext bc = BindingContext.getCurrent();
            String currentDataControlFrame = bc.getCurrentDataControlFrame();
            return bc.findDataControlFrame(currentDataControlFrame).isTransactionDirty();
    2. using commit button:
    Boolean changed = (Boolean)JSFUtils.getManagedBeanValue("bindings.Commit.enabled");
    But, both of them cannot reflect the change in case of postback caused by cancel button, as mentioned its immediate=true
    Any solution to find out changes if cancel  button pressed?
    Cheers,
    Nasser

    I have the same case, and I'm using the below code for the button action listener, with immediate=true.
        ControllerContext cctx = ControllerContext.getInstance();
            if (cctx.getCurrentRootViewPort().isDataDirty()) {
                RichPopup.PopupHints hints = new RichPopup.PopupHints();
                getExitPopup().show(hints);
    try this, maybe it will help.

  • In File Dialog, when click Cancel button, it prompts error and VI exits

    Does anyone can give me an idea on how to solve this problem? When the user click on the Cancel button in the File Dialog box, it prompts out error and says "Operation canceled by user". How can I handle this error?
    I got the same error when I click on the Cancel button when the system prompts me for replacing an existing file. Btw, how can I stop the system from prompting me to replace an existing file? Thankssss.....

    Hi,
    A similiar topic was discussed here
    http://forums.ni.com/ni/board/message?board.id=170&message.id=151316#M151316
    Hope it helps

  • Switching into a dialog window's buttons (ok/cancel) w/ a keybord shortcut

    how can i do this?
    on pc i'm used to press "tab" button to switch from the default option to the other.
    for example when selecting "shut down the computer" in the apple menu, it appears a dialog window saying "the computer will shut down in 1 m and ..." selected default button (blue) is CONTINUE, how do I switch to CANCEL button without using the mouse?
    Thank you

    Normally you use "tab" to move around within a dialog box on a Mac too, spiderresistance.
    To automatically hit the "cancel" button, though, use "esc"
    You can find very extensive lists of Mac keyboard shortcuts by going to the "Help" menu when in the Finder , choosing "Mac Help" and then typing "keyboard shortcuts" in the search box.
    Cheers
    Rod

  • How to handle "ok" and "cancel" button of dialog popup?

    Hello everyone,
    I'm using a dialog with type="okCancel". My question is how to handle ok and cancel button of this popup window. Here is my code below:
    <af:popup id="kriterPopup">
    <af:dialog title="Kriter Seçiniz" type="okCancel" inlineStyle="width:500px;height:400;" id="d2"
    dialogListener="#{BasvuruDegerlendirmeBean.kriterDialog}">
    <af:selectManyCheckbox label="Kriterler :" id="smc2"
    binding="#{BasvuruDegerlendirmeBean.kritersCheckbox}">
    <af:forEach items="#{BasvuruDegerlendirmeBean.kriterList}" var="item">
    <f:selectItem itemLabel="#{item.ybKriter.tur}" itemValue="#{item.ybKriter.tur}" id="si3"/>
    </af:forEach>
    </af:selectManyCheckbox>
    </af:dialog>
    </af:popup>
    I want to handle ok and cancel button of this window, and redirect to the pages which I want.
    Can anyone help me how I can do?
    Thanks, with my regards.
    Ali

    You need dialogListener..
        public void dialog1_dialogListener(DialogEvent dialogEvent) {
            if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.yes)){ //for Yes
            }else{ //for Cancel
        }

  • Previous page navigation after on click of cancel button of a form in adf

    Hi,
    Can any one tell how previous page navigation works in adf?
    I am working on a portal page which is having a common footer for all jspx pages.This footer contains a golink for feedback form.
    so the problem is when I Navigate to any page (# page 1)and then Navigate to some other page (#page 2) and on click of Feedback link displayed on footer of page 2 Feedback form is displayed. and on Click of Cancel button of the form.
    Expected Result:
    User should be navigated to the page that they were on. (i.e., Page 2)
    Actual Result:
    User is navigated to page 1 instead of page 2
    i.e it is taking browser previous url.
    I am using the following code for the cancel button
    <af:commandLink text="Cancel" id="cl5">
    <af:clientListener method="goBack" type="click"/>
    </af:commandLink>
    java script....
    function goBack()
    window.history.back()
    Edited by: 993530 on Apr 23, 2013 3:35 AM

    Hi,
    Immediate = true is already been set for cancel button
    The problem is when i come back to the 1st page vo is getting executed again and is taking lot of time.. i need to see that vo does not get executed again
    in the vo for view criteria -- query execution mode , i have made as in memory and now it has become fast on click of cancel button. But i am getting the following error when i perform search in the first page
    Missing FROM in a SELECT statement
    An unexpected expression token is found.
    Thanks,
    .

Maybe you are looking for

  • Getting Speed Less Than Paid For

    I paid for the High Speed Internet Access, and it stated I was supposed to achieve 768 Kbps - 1 Mbps in connection speeds. The maximum speed that I've ever achieved with my connection is 130Kbps... That's an outrageous speed for what I'm supposed

  • How to "Open iTunes automatically when iPod is connected"....

    ...without having them sync automatically?  I'm able to do this on my MBP just fine.  The solution on my MBP is to uncheck "prevent ipods, ipads, iphones from syncing automatically" under Devices Preferences.  Then I'm able to check "Open iTunes when

  • Need help with extracting a faint reflection from a window with Photoshop CS6, from a jpg photo

    I was wondering what tools are needed to be used to extract a clearer image of a reflection in a photo. I am using Photoshop CS6 (64 Bit). I don't know what else I should add. Please ask, and I will answer as much as I know. Regards, Isa

  • Trouble with my n73

    hi all, i am having trouble with my n73. i have a message that is trying to come thru, the envelope is flashing on my screen but i cannot retrieve it.my phone has displayed memory too low. delete some data. i have deleted as much as i could. I have a

  • [SOLVED] KDE Faenza icons aren't available

    It looks like the server that hosts the KFaenza icon set is down: http://kde-look.org/content/show.php?content=143890 http://omploader.org/vYjR0NQ I cannot find the latest version of this icon set anywhere else at the moment. Does anyone know another