webMethods

webMethods

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.  binding expression error

    Posted Tue August 16, 2016 11:20 AM

    Hi All,

    I want to do an interesting thing and up to now did not find any solution to solve it.

    I want to set the focus property of an element.
    Given a simple image object with a clientside click event setfocusitem(‘elementid’);

    There is a script block on page to handle this click event.
    Here is my javascript code:

    
    function setfocusitem(item){
    setTimeout(function() {   
    var elem = CAF.model("#{activePageBean.clientIds['"+item+"']}");  
    elem.setFocused(true);
    }, 1000);
    }

    It gets binding expression error.
    My question is that, how to concatenate the correct expression string in javascript.
    I want to use this javascript function from page, from more controls with different parameter, so it means the parameter ‘elementid’ is always different.

    Many thanks for your help.

    Zsolt


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


  • 2.  RE: binding expression error

    Posted Tue August 16, 2016 02:56 PM

    Resolving expressions is a server-side operation. So you can’t do the same logic from the client-side javascript.

    So you would either have to always pass the fully qualified controlId to the setfocusitem function and then to the logic like below:

    function setfocusitem(item) {
    setTimeout(function() {   
    var elem = CAF.model(item);  
    elem.setFocused(true);
    }, 1000);
    }

    Or concat the relative part of the id to an ancestor that was resolved on the server-side with something like this:

    function setfocusitem(item){
    setTimeout(function() {   
    var elem = CAF.model("#{caf:cid('defaultForm')}" + ":" + item);  
    elem.setFocused(true);
    }, 1000);
    }

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


  • 3.  RE: binding expression error

    Posted Wed August 17, 2016 04:16 AM

    Hi Eric,

    Thanks for your answer.
    I use the fully qualified controlId, and your first suggestion is working well.

    Many thanks and have a nice day.

    Zsolt


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