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.  set focus?

    Posted Fri March 08, 2013 09:05 AM

    hot to set focus will be done after a server round trip…if no error

    thanks!

    PD: don´t work on load of the page with below code in a script block

    Is it possible by setting from java?


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


  • 2.  RE: set focus?

    Posted Fri March 08, 2013 11:43 AM

    If the control that is being refreshed by your round trip is a form control or one of the hideable panel controls, then you could try setting the value of the ‘Default Focus’ property of the panel/form control to the id of the input control that you want to have focus after the refresh has completed.

    Otherwise you should be able to set the focus progammatically from a script from an action complete listener that is attached to the command control that did the action. For example, something like this in a script block that is outside the control being refreshed:

    //declare the custom function and store it on the window object
    window.doCustomFocusFn = function(){ 
    CAF.model("#{activePageBean.clientIds['htmlSelectOneMenu1']}").setFocused(true);
    } 
    
    //remove the previous reference just in case, so we don't get duplicates
    CAF.model("#{activePageBean.clientIds['button']}").removeActionCompleteListener(window.doCustomFocusFn); 
    
    //add a reference to the custom listener
    CAF.model("#{activePageBean.clientIds['button']}").addActionCompleteListener(window.doCustomFocusFn); 

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


  • 3.  RE: set focus?

    Posted Fri March 08, 2013 02:02 PM

    How I can set ‘Default Focus’ property of the form from java? with control accessor?

    or Javascript??

    I have multiples dropdows on my screen, all run some action in onChange. I need the focus set dynamically in the dropdow which was executed


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


  • 4.  RE: set focus?

    Posted Fri March 08, 2013 02:14 PM

    You can set the value from the property of the form control in the view editor.


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


  • 5.  RE: set focus?

    Posted Fri March 08, 2013 02:26 PM

    yes, i see this. But ¿ how i can set this value with ID of dropdown the customer changed? considering that are multiple in task


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


  • 6.  RE: set focus?

    Posted Fri March 08, 2013 03:06 PM

    The value can be an expression.

    So you can make it dynamic by:

    • add a string field to you page java class.
    • Update the value of that field when appropriate.
    • Bind the ‘Default Focus’ property value to an expression that resolves to your custom string field.

    Though, I haven’t verified this, but if the value is changing in the middle of refreshing a control, you might need to use the script approach instead, since this information would probably need to be known on the client side before the action/refresh starts.


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


  • 7.  RE: set focus?

    Posted Fri March 08, 2013 03:09 PM

    Another possibility is to do what you were originally doing in a script block after a short delay.

    For example:

    setTimeout(function() { 
    CAF.model("#{activePageBean.clientIds['htmlSelectOneMenu1']}").setFocused(true);
    }, 100);

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