IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Confirmation before deleting Row

    Posted Wed September 14, 2011 01:03 PM

    Hi,

    On an AsyncTable I have a RemoveRowButton to which I would like the user to confirm its action before proceeding.

    Is there a way to add a listener to this Button so I can call a function before the action and returning false would stop it from deleting the row?

    The RemoveRowButton does not have Client-Side Events and using a CustomScript For that control has no effect.


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 2.  RE: Confirmation before deleting Row

    Posted Thu September 15, 2011 05:10 PM

    You’ll have to replace the onClick handler for the RemoveRow button.

    
    //get the remove Button Model
    var button = CAF.model("jsf:defaultForm:zzz1:__rowid0:removeRowButton");
    
    //store the current onclick
    var _onclick = button.element.onclick;
    
    //create your custom onClick
    button.element.onclick = function() {
    //todo add your validation function
    //delegate to the original onclick
    _onclick();
    };
    

    Hope this helps.
    Regards,
    –mark


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: Confirmation before deleting Row

    Posted Thu September 15, 2011 05:29 PM

    Is it possible to use something like

    var button = CAF.model(‘#{caf:cid(“removeRowButton”)}’);

    Otherwise, the code will have to get all rows’ id and loop to change every existing buttons (which will change on every page’s refresh).


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 4.  RE: Confirmation before deleting Row

    Posted Thu September 15, 2011 06:01 PM

    In every row, you probably have a remove row button, correct?

    If so, just add a ScriptBlock in every row, and in the script block you’ll have javascript like the sample above, but dynamically looking up each row:

    //get the remove Button Model 
    var button = CAF.model("#{caf:cid('removeRowButton')}"); 
    
    //store the current onclick 
    var _onclick = button.element.onclick; 
    
    //create your custom onClick 
    button.element.onclick = function() { 
    //todo add your validation function 
    alert("hello");
    //delegate to the original onclick 
    _onclick(); 
    }; 

    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS


  • 5.  RE: Confirmation before deleting Row

    Posted Thu October 27, 2011 09:54 AM

    Hello,

    Following your suggestion I have inserted a Script Block inside a Remove Row Icon in the row with the following code:

    //get the remove Button Model   
    var button = CAF.model("#{caf:cid('defaultForm:removeRowIcon')}");   
    
    //store the current onclick   
    var _onclick = button.element.onclick;   
    
    //custom onClick
    //based on the result of the confirm() dialog.
    button.element.onclick = function() {   
    if (confirm("really delete?")) _onclick(); else return(false);
    };

    This way the row is not deleted if Cancel is pressed.

    Best Regards,
    Gerardo Lisboa


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 6.  RE: Confirmation before deleting Row

    Posted Thu October 27, 2011 05:49 PM