Topic
11 replies Latest Post - ‏2013-04-25T14:31:11Z by Raj4All
Raj4All
Raj4All
77 Posts
ACCEPTED ANSWER

Pinned topic How to bind / use Process Variables in Custom HTML Blocks present in Coaches / Coach Views in IBM BPM 8.0.1

‏2013-04-24T11:45:05Z |

Hi Kolban / Makvell,

The below is the requirement i have

1) Is accessing content / data of the Textbox is possible using dojo.byId and document.getElementById .When i use same in Heritage Coach i am able to access the Fields data.Do i have to add anything to Import DOJO to work in Coach Views.The requirement is to get this work in Coach  View.

2) we are trying to access the process variable in a Custom HTML Script using eg:<#= tw.local.rate #> and also using "tw#local#rate".The above snippets work after binding the data to the variable when we use Heritage Coaches , but the same is not working whe we try to use this in a coach view.

and "Kolban" Replied saying,

In BPM v8 the whole coach framework was reworked/replaced.  The pre-v8 Coach technology is still present and is now called "heritage coaches".  If you use those. I believe you will have all the functions you used to have.  However, the new v8 Coaches are (opinion) vastly superior but require you to learn the new concepts of Coach Views.  These are the encapsulations for logic and other functions.  It is no longer meaningful to try and access the "HTML" of a Coach in Custom HTML.  Instead, you would want to write new Coach Views which have the desired function.

For example, the new V8 Coach View called "Text Input" is bound to a variable.  When the user changes the text in the screen, the corresponding variable is immediately updated.  This can then be used to immediately trigger another Coach View that is watching to see any changes and it can perform arbitrary logic based on the variable change.

Kolban / Makvell,

Can you Please share a small working example for the scenario marked in red in the above and please provide me some valuable links,tutorials to get a better understanding on the COACH VIEW Event Handling technique and the CONTEXT object in COACH VIEW.

Thanks.

 

 

Updated on 2013-04-25T14:29:13Z at 2013-04-25T14:29:13Z by Raj4All
  • makvell
    makvell
    269 Posts
    ACCEPTED ANSWER

    Re: How to bind / use Process Variables in Coaches / Coach Views in the Custom HTML Blocks in IBM BPM 8.0.1

    ‏2013-04-24T12:32:55Z  in response to Raj4All

    So what's the problem?
    Make a copy of the textbox control and add the event publishing functionality on value changes. And in another coach view add code to subscribe to this event and program logic as you need.

    Start here: http://dojotoolkit.org/reference-guide/1.7/dojo/publish.html

    • Raj4All
      Raj4All
      77 Posts
      ACCEPTED ANSWER

      Re: How to bind / use Process Variables in Coaches / Coach Views in the Custom HTML Blocks in IBM BPM 8.0.1

      ‏2013-04-24T14:12:00Z  in response to makvell

      Hi Makvell,

      I am new to DOJO and started looking in to it from few days.If you can explain in much more clean way then it will help me or a small working example with a a Textbox will surely satisfy my need.

      In the mean time i will go through the link shared.

      Thanks.

      • makvell
        makvell
        269 Posts
        ACCEPTED ANSWER

        Re: How to bind / use Process Variables in Coaches / Coach Views in the Custom HTML Blocks in IBM BPM 8.0.1

        ‏2013-04-25T05:53:15Z  in response to Raj4All

        Copy text CV to your processapp/toolkit and do some modification.

        In "load" event handler, replace function:

        onChangeHandle = connect.connect(comboBox, "onChange", this, function() {
            if (this.context.binding && comboBox.isValid()) {
                this.context.binding.set("value", comboBox.get('value'));
            }
        });

        with:

        onChangeHandle = connect.connect(comboBox, "onChange", this, function() {
            var ctx = this.context;
            if (ctx.binding && comboBox.isValid()) {
                ctx.binding.set("value", comboBox.get('value'));
                //publish event with CV id and new value
                connect.publish("textboxupdate", {
                    viewid: ctx.viewid,
                    value: comboBox.get('value')
                });
            }
        });

        And where you need react on this change, add function:

        require(["dojo/_base/connect"], function(connect){
            connect.subscribe("textboxupdate", function(mess){
                //replace this line with your logic
                alert("Changed textbox with id: " + mess.viewid + ", new value is: " + mess.value);
            });
        });

        Updated on 2013-04-25T07:16:26Z at 2013-04-25T07:16:26Z by makvell
    • kolban
      kolban
      3314 Posts
      ACCEPTED ANSWER

      Re: How to bind / use Process Variables in Coaches / Coach Views in the Custom HTML Blocks in IBM BPM 8.0.1

      ‏2013-04-24T19:56:38Z  in response to makvell

       

      LOL on your chosen image for the forums.  Ive never seen anyone do that before but now you have, it seems obvious.  Made my day to see that.

       

      Neil