Delaying the command link action till user presses Yes/No in dialog

Hi ,
On a command link in an af:table i am trying to display and Yes/No Dialog box. On clicking the link, the action binded with the link gets executed first and then the dialog gets initialized. Can we some how deffer the link execution till the user presses Yes/NO?
following is the code
=======================================================================
<af:column id="c13" headerText="Lock">
<af:commandLink
text="lockUser"
disabled="#{!bindings.lockUser.enabled}"
id="cl1"
action="#{searchBean.lockUser}"
partialSubmit="true"
partialTriggers="cl1" >
<af:showPopupBehavior popupId="::p1"
triggerType="click"/>
</af:commandLink>
</af:column>
=======================================================================
<af:popup id="p1" partialTriggers="p1">
<af:dialog id="d2" dialogListener="#{searchBean.dialogListener}"
partialTriggers="d2" title="xcx" type="okCancel"/>
</af:popup>
=======================================================================
public String lockUser() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("lockUser");
Object result = operationBinding.execute();
System.out.println("***111");
if (!operationBinding.getErrors().isEmpty()) {
return null;
searchUser();
return null;
=======================================================================
public void dialogListener(DialogEvent dialogEvent)
String ss="HHH";
System.out.println(ss);
if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok))
lockUser();
System.out.println("SAVE your work here");
}else
System.out.println("Do Not Do Any Thing");
=======================================================================

This should be possible, if you remove the action from the af:commandLink and execute the action in the dialoglistener
    public void dialogListener(DialogEvent dialogEvent)
        Outcome lOutcome = dialogEvent.getOutcome();
        if (lOutcome.equals(Outcome.ok))
            // do the navigation
            ControllerContext ccontext = ControllerContext.getInstance();
            //set the viewId – the name of the view activity to
            //go to - to display
            String viewId = "Emp";
            ccontext.getCurrentViewPort().setViewId(viewId);
            // or execute a method....
    }Timo

Similar Messages

  • Focus should remain at the command link

    I have Command links and I want to do everythibg(moving from one link to other and want to perform operation) using "tab" key instead of selecting it through mouse.
    when ever user selects the command link,one popup will be displayed
    ,under the popup,a dialog window of type "ok Cancel" was taken,in the dialog window one input text was taken.
    The Problem is without entering the text in the input text and clicking on ok button using tab,remains the focus of the cursor on the command link and
    also while clicking on the cancel button the cursor position remains at the command link only but
    when ever user enters the text in the input text and
    selects the ok button using tab,the cursor focus is moving to top of the page,not remains at the command link.This problem is not taking place while
    using mouse.
    Can anyone please tell me how to the remain the focus at the command link.
    I am using jdev 11.1.2.3

    Okay, that makes sense. However, I modified my code to actually move the lead, and it still didn't work. Curious, I added a pop up window to the code, and I found out that it doesn't get called. The tab key still doesn't do anything. I miss KeyListeners already :(
    Can you spot anything wrong with how I'm doing this?
    InputMap im = _table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    KeyStroke tabKey = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
    Action tabAction = new AbstractAction(){
                   public void actionPerformed(ActionEvent e){
                        int leadColumn = _table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
                        leadColumn ++;
                        if(leadColumn > 4){
                             leadColumn = 4;;
                        _table.getColumnModel().getSelectionModel().setLeadSelectionIndex(leadColumn);
                        JOptionPane.showMessageDialog(null, "L: " + leadColumn);  //this doesn't happen either
    im.put(tabKey, tabAction);

  • Command link action not being called

    Hi,
    I raised another bug about this and I thought I had fixed this but it seems to have come back again! Here are the details:
    The Problem
    - I have a jsf application that uses SDO to manage database calls/changes. In the application I have a navigation menu which consists of command links. From time to time (doesn't always happen) you click on a link and the page just refreshes and you are not taken to the requested page. Now this doesn't happen all the time! I've looked at logs and added debugs but I can't find anything apart from the face that when the page just refreshes the action behind the command link is not called.
    Has anyone experienced this before? I'm using wsad 5.1.2 and have this problem and the version of faces is 1.0.
    Please help as I have no idea what is causing this!!

    yep, sorry for reposting but in that post I said I had it fixed but obviously its not. What's really change is that I cant recreate this problem on my laptop but on our dev and test environments this problem still exists. My initial thoughts is that this is an environment problem but i'm not totally convinced as the was settings etc are the same as on my laptop.

  • On Command Link Action is not Firing

    Hi
    I am using JDev Version 11.1.1.6
    I have command link where i wrote a method in bean for Action. And the same command link has the showpopup behaviour
    My assumption was on click of command link Action method fires first then showpopup behaviour fires next.
    But when i click on command link action method is not firing, only showpopup behaviour is firing .
    is it expected behaviour?
    Many Thanks,
    ~Jagadeesh Badri

    Hi Jagadeesh
    Yes, it is an expected behaviour. The documentation about af:showPopUpBehaviour says that:
    The showPopupBehavior tag cancels the client event defined by the triggerType. Canceling the client event will prevent delivery to the server. This is significant for action events raised by command family components because the server-side action listeners will be ignored. All actionListener method bindings and associated action listeners will not be invoked when the triggerType of "action" is used.
    This means that if you use the triggertype of action, then your action method in the link will be ignored. Maybe if you change the triggerType to 'Click' you will get your actionListener triggered and the popup showed.

  • Why getting "Run-time error 2046 the command or action 'GoToRecord' isn't available now"

    Hello,
    I'm running this on Form Load:
    Private Sub Form_Load()DoCmd.GoToRecord , , acNewRec
    End Sub
    when I'm in the office connected to the LAN, the database opens without any error but when
    I'm working remote through a VPN, I get this error:
    Run-time error 2046 the command or action 'GoToRecord' isn't available now.
    I'm wondering if this is related to a speed issue and more importantly, how to fix it?
    Thanks,

    Make absolutely sure the query behind the form is updateable and the form allows edits
    Use the following code with the forms On Open event:
    DoCmd.ShowAllRecords
    DoCmd.GoToRecord , , acNewRec
    See if that helps. Have no clue why it would work in one environment but not another.

  • Making "Go to a Page View" the Default Link Action

    Up until recently, it was quick and easy for me to add a "Go to a Page View" link to PDFs in Acrobat Pro. I highlighted the text I wanted to link, right-clicked on it, and then selected Create Link from the pop-up menu. At that point, the Create Link box would be displayed:
    After clicking Next, the Create Go to View box would be displayed:
    I would then scroll to the the page I wanted to link to, click Set Link, and then the process was complete. I don't know if I have inadvertently changed settings or if things are different in the most recent version of Acrobat Pro, but now I have to go through several more steps to do the same thing. Here's what I have to do now.
    1. Highlight and right-click on the text. Select Create Link from the pop-up menu. The Create Link box is displayed.
    2. Click Next. The Link Properties box is displayed.
    3. Click OK. The Link Properties box is displayed. Click on the Actions tab.
    4. Select Go to a Page View from the Select Action drop-down menu.
    5. Click Add. The Create Go to View box is displayed.
    6. Scroll to the appropriate page and click OK. The Link Properties box is displayed AGAIN.
    7. Click OK, and FINALLY the process is over.
    I've looked online for an answer but can't find anything. I'm guessing that I'm just missing something small but as of yet it eludes me. I've tried messing around with the Locked check boxes, thinking that they may lock the settings, but to no avail. Can anyone help me get back to the much shorter process?
    Thanks in advance.

    Hi tedbeam,
    What happens when you select the Add or Edit Link tool on the Content Editing pane in the Tools panel? When you use that tool, you can drag a box around the text that you want to link, and the Link Action options should appear in the first dialog box that pops-up. Then you can change the view to the appropriate page, and click Set Link.
    That should simplify the process a bit.
    Please let us know how it goes.
    Best,
    Sara

  • Download file link in adf command link action

    Hi,
    i want to make a link on my web page , when my users click that link they can download a file
    how can i do that
    i use the thread
    Re: Download File Link in jspx
    but not works for me
    could any one help me to sort out the issue
    Thanks in advance

    Hi,
    i want to make a link on my web page , when my users click that link they can download a file
    how can i do that
    i use the thread
    Re: Download File Link in jspx
    but not works for me
    could any one help me to sort out the issue
    Thanks in advance

  • Command link action

    I am using a commandlink with an action that returns a value for navigation. The action fires every other time I click the link.
    Here is my tag:
    <h:commandLink
    id="customer"
    action="#{navigateBean.customerSelected}"
    target="content">
    <f:verbatim>
    <P>1. Customer</P>
    </f:verbatim>
    </h:commandLink>Any thoughts?
    Thanks!
    Ted

    The target attribute seemed to work, but I couldn't get around the action firing every other click. I ended up doing away with frame navigation and used the panelNavigation tag from MyFaces wrapped in a facet tag. Must be a frame issue.

  • Page change the current row when concurrent users press save in the same ti

    I have a problem that appear only when a lot of users are running at the same time
    that I have an editable form that have save button some times when I press save the current row that I edit is changed or return null row.
    for example imagine that I edit employee that has Id = 50 when a lot of users running on the application at the same time when I press save the record changed to another employee that has id = 49 or returns empty form
    in my code for save I call application module method that have code similar to this
            myViewRowImpl viewimpl =
                (myViewRowImpl )getMyView().getCurrentRow();
            getDBTransaction().commit();I build my ADF fusion web application using ver 11.1.1.3

    Hi,
    sounds like a passivation problem.You can also try and change the AM pool size.
    Read up here:
    http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcservices.htm#sthref873
    http://docs.oracle.com/cd/E21764_01/web.1111/b31974/bcampool.htm#sm0299
    Frank

  • In Request type, what is the difference between action 'Change user' and 'Assign object'

    Dear All,
    I have used only 'Assign Object' for my 'Change User' request type. But the standard request type has 'Change user'. So, could you suggest , what additional purpose does Change Object serve
    Regards
    Plaban

    HI Plaban
    not sure if you answered your own question here?
    Change User - by itself would allow update of address data, user parameters, defaults, etc
    Assign Object - as you mentioned roles and profiles.
    However, if assigning, I think you need to have both actions: change and assign
    I recall (ages ago) that change was only the user details and not the role or profiles. As a result, there were a few threads where people had to update the action for the request type of provisioning would not occur.
    This is something you could test
    Regards
    Colleen

  • Conversion error occurs in all the command button actions

    we have two h:commandButton (save and back) in a jsf form.
    If i click the save button conversion for the form fields should happen(its happening correctly).
    But if i click the back button it should directly take me to the backing bean's action method without any conversion so that i can avoid the conversion errors.
    Is there any solution or work around to achieve this.
    Thanks,
    success_21

    success_21 wrote:
    thanks for your response. below is the exact scenario for which we are looking for a solution,
    <rich:calendar value="#{MyBean.date}" id="dat" datePattern="MM/dd/yyyy" >
    <f:validator validatorId="isValidDate" />
    </rich:calendar>
    <h:inputText value="#{MyBean.str}" id="str"> </h:inputText>     
    <h:commandButton value="save" action="#{MyBean.save}"/>
    <h:commandButton value="back" action="#{MyBean.back}"/>
    but in our case, during the back action method we need the bean value(id="str") for calculation but we don't want conversion to be happened for calendar field. if we use immediate attribute for back button we will not get the bean value(id="str") in the action method. is there any alternate solution to this.I cannot think of a standard technique to handle this case, where some of the data is needed but other data should be ignored. You might try to grab the value from the request parameter map and manually assign it to the model (this work around doesn't scale however).
    Perhaps what might work is to have a valueChangeListener on the fields which will be preserved; I think they will be fired even with the immediate attribute.
    I do not think the <f:attribute> solution suggested will work as attributes are server side artifacts.

  • Invoking a command link's action from a javascript, on pressing enter key

    i have the foll java script function. on pressing enter within an input field i want a certain commandlink's action to be automatically performed:
    function checkKeycode() {
         alert("entered");
              var keycode;
              if (window.event) keycode = window.event.keyCode;
              //else if (e) keycode = e.which;
              if(keycode==13){               
                   alert("keycode: " + keycode);           
                   var x=document.getElementById("form10:link1");
                   alert("about to click");
                   x.click();
                   //document.forms[0].link1.click();               
                   //if(validate('form1:_system_username,form1:_system_password','form1:_id0,form1:_id1','2'))
                        //alert("about to submit page");
                        //submitPage();
         }This fn is being called from the input text as follows:
    <h:inputText styleClass="inputText" id="text1" size="32" onkeypress="checkKeycode();"></h:inputText>And the code containing the command link who's action i want to be called is:
    <h:commandLink styleClass="commandLink" id="link1"
                             action="#{pc_Test.doLink1Action1}">
                             <hx:graphicImageEx border="0" styleClass="graphicImageEx"
                                  id="imageEx1" url="../../images/search.gif"></hx:graphicImageEx>
                        </h:commandLink>
    The javascript is being entered as i get an alert saying that enter key was pressed. However it is not performing the action requried, saying that "null is null or not an object"
    could sumone please help????

    Hi
    From your javascript , it is known that this is only work in IE,
    And indeed it works fine, mybe there is another button which the default in your jsp
    Change your code like this:
    onkeypress="return checkKeycode();"
    and at end of your javascript return false when you call x.click
    Message was edited by:
    okoi80

  • Resetting the id of dynamically generated JSF custom command link

    I have a java faces page which displays data from an arraylist.
    This list is populated when user inputs data in the input text field and clicks "Add Group" button.
    The arralylist consist of another arraylist within the former.
    I have created a custom command link for the former arraylist.
    As an user can add data to the arraylist so can he remove it from the arraylist.
    The command link has a method binding "closeTask" which is invoked when command link is clicked.
    This action removes the clicked element from the arraylist and displays the fresh list.
    The key field from the bean in the former arraylist is set in request, and is retrieved in the "closeTask" method to be assigned to the command link output text id (i.e. it identifies the element that is to be deleted from the arraylist).
    This functionality does not work as expected, i.e. command link component is not created/rendered during deletion as it is created while addition.
    As a result eventhough the element is removed from the arraylist, the id corresponding to the fresh arraylist is not refreshed and for further actions correct id is not passed and the deletion function does not work.
    How can I have resolve this problem?
    The sample code is included.
    Thanks in advance.
    Java Faces Code:
    <%
    FacesContext facesContext = FacesContext.getCurrentInstance();
    Application app = facesContext.getApplication();
    Bkbean bean = (Bkbean)app.createValueBinding("#{bckbean}").getValue(facesContext);
    List aList = bean.getAList();
    if(aList!=null && aList.size()>0) {                                                            
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    int keyValue = abean.getKey();
    request.setAttribute("key", String.valueOf(keyValue));
    %>
    <TR>
    <TD width="90%">
    <%=abean.getCtg()%>
    </TD>
    <TD width="9%">
    <%=abean.getKey()%>
    </TD>
    <TD width="1%" align="right" valign="top">
    <h:commandLink binding="#{bckbean.commandLnk}" styleClass="commandLink">
    </h:commandLink>
    </TD>
    </TR>
    <%
    List dList = abean.getDList();
    if(dList!=null) {
    for(int j=0; j<dList.size(); j++) {
    String tData = (String) dList.get(j);
    %>
    <TR>
    <TD width="90%">
    <%=tData%>
    </TD>
    <TD width="10%" colspan="2">
    </TD>
    </TR>
    <%
    }%>
    <%
    %>
    <TR>
    <TD align="right">
    <h:inputText id="inputtxt001" value="#{bckbean.val}"></h:inputText>
    </TD>
    <TD align="left" colspan="2">
    <hx:commandExButton type="submit" value=" Add Group " styleClass="commandExButton" id="submitbtn001" action="#{bckbean.addVal}">
    </hx:commandExButton>
    </TD>
    </TR>
    Backing Bean Code:
    public void closeTask(ActionEvent event) {
    String key = "";
    UIOutput lnkTxt = null;
    UICommand comp = (UICommand)event.getComponent();
    if(comp.getChildren() != null && comp.getChildren().size() >0) {
    for (int i=0; i<comp.getChildren().size(); i++) {
    lnkTxt = (UIOutput)comp.getChildren().get(i);
    key = lnkTxt.getId();
    int selectedKey = (new Integer(key.substring(2))).intValue();
    if(aList!=null) {
    for(int i=0; i<aList.size(); i++) {
    ABean abean = (ABean) aList.get(i);
    if(abean.getKey()==selectedKey) {                                             
    aList.remove(i);
    break;
    public UICommand getCommandLnk() {
    String id = (String) request.getAttribute("key");
    UICommand commandLnk = new UICommand();
    commandLnk.setId("key" + id);
    UIOutput outTxt = new UIOutput();
    outTxt.setId("id"+id);
    outTxt.setValue("X");
    commandLnk.getChildren().add(outTxt);
    MethodBinding mb = app.createMethodBinding("#{bckbean.closeTask}", new Class[]{ActionEvent.class});
    commandLnk.setActionListener(mb);
    commandLnk.setImmediate(true);
    return commandLnk;
    }

    You cud define jsObjectNeeded and onClientClick properties for the htlm component and catch the event to find itz ID.
    This might help you:
    Accessing HTMLB form values from JAVASCRIPT
    To give you an idea abt how the code works:
    Portal: Bug in the  radio button's javascript api
    Regards,
    N.
    Plz click a star if it helped.

  • Popup is closed when command link is pressed even after validation exceptio

    Hi Techies,
    I am using JDeveloper 11.1.1.4. I have a sample .jspx page which has a table, a command link and a popup. When the user clicks the command link, the popup gets shown.
    The popup contains af:panelWindow as a direct child. panel window as a panel group layout which contains input box and a command link. The input text has a validation. Now my problem is even though the validation fails If i click the command link in the popup, the popup gets disappeared. Thankfully it is not updated in the database (Infact, the action and actionlisteners themselves are not getting called since the validation fails. Hope this is the expected behaviour) But my question is: could somebody tell my how to prevent the popup from hiding when i click the command link in popup once after the validation fails?
    Regards,
    V. Praveen

    Hi Praveen,
    Can you try with partialSubmit for the command link?
    Also use required partialTriggers as you want to refresh. Do not refresh the popup in your bean code.
    -Prasad

  • Command link / button action is not taking place if i use it in iterator.

    Hi,
    I am new to ADF, i am facing 1 issue while implementing ADF mobile browser application.
    Issue: command link / button action is not taking place if i use it in iterator. its just refreshing the page it self and displaying as no records.
    Scenario is i am populating the search results in results page from search page using iterator, i want to get the complete details in different page (results page -> details page) .
    I have tried in different ways.like
    case1:
    <tr:panelGroupLayout id="pgl2" layout="vertical" styleClass="af_m_panelBase">
    <tr:panelHeader text="#{classviewBundle.SEARCH_RESULTS}" id="ph1"/>
    <tr:iterator id="i1" value="#{bindings.SubjectVO1.collectionModel}" var="subject"
    varStatus="subIndx" rows="100">
    <tr:panelBox text="#{subject.Subject} #{subject.CatalogNbr} - #{subject.CourseTitleLong}"
    styleClass="af_m_listingPrimaryDetails" id="pb1">
    <f:facet name="toolbar"/>
    <tr:table var="ssrClass" rowBandingInterval="1" id="t1" value="#{subject.children}"
    varStatus="clsIndx" rowSelection="none"
    binding="#{SessionBean.subjectTable}" verticalGridVisible="true"
    emptyText="No Records" width="100%">
    <tr:column id="c9" sortable="false" styleClass="width:100%">
    <*tr:commandLink text="Section: #{ssrClass.ClassSection}-#{ssrClass.SsrComponentLovDescr} (#{ssrClass.ClassNbr})"*
    id="commandLink2" styleClass="af_m_listingLink"
    *action="#{pageFlowScope.BackingBean.searchaction}"></tr:commandLink>*
    //remaining code
    in this case commandlink action is not able to invoke serachaction() method
    case 2:
    <tr:commandLink text="Section: #{ssrClass.ClassSection}-#{ssrClass.SsrComponentLovDescr} (#{ssrClass.ClassNbr})"
    id="commandLink2" styleClass="af_m_listingLink"
    action="classdetails}"></tr:commandLink>
    in this case its not able to navigate to classdetails page.
    I gave correct navigation cases and rules in taskflow,but its working fine when the command link is out of iterator only.
    i tried with actionlistener too.. but no use.. please help me out of this problem .
    *Update to issue:*
    The actual issue is when i use command link/button in an table/iterator whose parent tag is another iterator then the action is not taking place.
    the structer of my code is
    < iterator1>
    #command link action1
    < iterator2>
    #command link action2
    </ iterator2>
    < /iterator1>
    #command link action1 is working but "#command link action2" is not...
    Thanks
    Shyam
    Edited by: shyam on Dec 26, 2011 5:40 PM

    Hi,
    To solve my problem I used a af:foreach instead.
    <af:forEach items="#{viewScope.DataBySubjectServiceBean.toArray}" var="text">
    <af:commandLink text="#{text.IndTextEn}" action="indicator-selected" id="cl1">
    <af:setActionListener from="#{text.IndCode}" to="#{pageFlowScope.IndicatorCodeParam}" />
    </af:commandLink>
    </af:forEach>
    By the way you need to convert the iterator to an Array using a ManagedBean.
    public Object[] toArray() {
    CollectionModel cm = (CollectionModel) getEL("#{bindings.TView1.collectionModel}");
    indicators = new Object[cm.getRowCount()];
    for(int i=0;i<cm.getRowCount();i++){
    indicators[i] = cm.getRowData(i);
    return indicators;
    public static Object getEL(String expr) {
    FacesContext fc = FacesContext.getCurrentInstance();
    return fc.getApplication().evaluateExpressionGet(fc,expr,Object.class);
    Hope that helps-
    Edited by: JuJuZ on Jan 3, 2012 12:23 AM
    Add getEL Method

Maybe you are looking for

  • How do I extend (i.e. add more points to the end of) a Bezier path?

    What's the easiest way of making a Bezier path longer by adding more points to the end? I can do it by moving the end point to where I want the new end to be using the Direct Select tool, then using the Add Point tool to replace the old end point and

  • Moving playlist from old iPod to new iPod touch

    My son is getting a new iPod touch for Christmas.  His music is saved as a playlist under my apple id.  How do I move it over to his new iPod touch, under his apple id?

  • ALV fields which are not referenced to data dictionary table fields

    Hello, I am using function module reuse_alv_popup_to_select. How do I display fields in ALV which are not referenced to data dictionary table fields. I am showing 4 columns in alv out of which first column is checkbox and remaining 3 columns are from

  • Did I just delete my imovie 08?

    So I installed ilife 08 (i really just wanted imovie) and THEN installed ilife 06 (just wanted imovieHD)....now its like I only have ilife 06.  is there a proper order or process I should've taken?  and can I ONLY install the movie things?  maybe iph

  • No credit card, based uk

    no credit card, based UK, i've followed the usual instructions as posted but the last bit asks me for a usa address/phone no/zip code so I can't complete the create ID bit..what to do..??