Topic
15 replies Latest Post - ‏2014-12-16T16:58:43Z by sierrapto
Raj4All
Raj4All
77 Posts
ACCEPTED ANSWER

Pinned topic How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

‏2013-04-17T18:52:56Z |

Hi All,

I am trying to access Coach Pallette components (TextBox,TextArea,Calender etc) data  using DOJO and Javascript.Can any one help me how to access the data in the Textbox for an instance and use it in the Javascript and DOJO script.

Note:

I do have another requirement , i want to access the Textbox value when i change / press a key each time.Please help me in this regard.

Thanks,
 

  • J0n35y
    J0n35y
    12 Posts
    ACCEPTED ANSWER

    Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

    ‏2013-04-18T06:20:48Z  in response to Raj4All

    Hi,

    What version of the product are you using?

    Have you tried using

    dojo.byId('NameOfComponent').value

    within your javascript to get the value?

    the name of the component in v7.2 is set in the Control Id section for the component, by deafualt its something like 'InputText0'

    As for accessing the text box on a keypress, you could use 'onChange' from within the events section of the textbox to run a function in your javascript, passing in the value of the textbox as a parameter.

    That make sense?

    • Deepikaa
      Deepikaa
      8 Posts
      ACCEPTED ANSWER

      Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

      ‏2013-04-18T11:23:25Z  in response to J0n35y

      Attachments

      Updated on 2013-04-18T11:24:01Z at 2013-04-18T11:24:01Z by Deepikaa
      • Deepikaa
        Deepikaa
        8 Posts
        ACCEPTED ANSWER

        http://vimeo.com/25737006 - I am not able to write in the content box. This videos also shows the same. For my process, date updation is not workign

        ‏2013-04-18T11:25:11Z  in response to Deepikaa
        • J0n35y
          J0n35y
          12 Posts
          ACCEPTED ANSWER

          Re: http://vimeo.com/25737006 - I am not able to write in the content box. This videos also shows the same. For my process, date updation is not workign

          ‏2013-04-18T13:12:45Z  in response to Deepikaa

          I'm not sure this is related to the original request on this post.  You want to start a new topic for this one?

        • Raj4All
          Raj4All
          77 Posts
          ACCEPTED ANSWER

          Re: http://vimeo.com/25737006 - I am not able to write in the content box. This videos also shows the same. For my process, date updation is not workign

          ‏2013-04-18T13:35:35Z  in response to Deepikaa

          I am using IBM  BPM 8.0.1 to work with dojo.byId.

          I tried the logic in the above video and the dojo.byId("id").value is working in Heritage Coaches but the same logic is not working when i am using Coach views.I used alert statement in Custom HTML block and able to print some text (alert("Hello")), but when i use alert(dojo.byId("id").value) the statement is not retuning anything.I am not sure where i am going wrong in Coach View.

           

          Can any one give some idea on this.

          • J0n35y
            J0n35y
            12 Posts
            ACCEPTED ANSWER

            Re: http://vimeo.com/25737006 - I am not able to write in the content box. This videos also shows the same. For my process, date updation is not workign

            ‏2013-04-18T14:10:58Z  in response to Raj4All

            Sorry I don't have any experience in 8.0.1

          • Deepthi_Gujjar
            Deepthi_Gujjar
            3 Posts
            ACCEPTED ANSWER

            Re: http://vimeo.com/25737006 - I am not able to write in the content box. This videos also shows the same. For my process, date updation is not workign

            ‏2013-04-29T13:10:19Z  in response to Raj4All

            Use the same in inline javascript it would work there.

             

  • makvell
    makvell
    269 Posts
    ACCEPTED ANSWER

    Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

    ‏2013-04-19T06:28:02Z  in response to Raj4All

    Hi!

    Why do you need it? What are you trying to implement? You have a great tool - Coach Views. Create a Coach View, which you need for your application, it's not difficult.

    Updated on 2013-04-19T06:28:13Z at 2013-04-19T06:28:13Z by makvell
    • Raj4All
      Raj4All
      77 Posts
      ACCEPTED ANSWER

      Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

      ‏2013-04-19T06:57:57Z  in response to makvell

      Hi,

      I have a requirement to generate Charts(Pie Chart) dynamically.The requirement is, for an instance assume i have Five Text Boxes and user will type in some integer value in first box (Eg: 10) and dynamically a Pie chart should pop up with  value of 10 (as 100 %) completely occupied in PIE Chart.Next User will type in second box (Eg: 10) again so the PIE chart should change dynamically and should have values of First and Second box in it displaying 50% of  Chart with First box data and 50% of Chart with second and this process is same for the rest of the three boxes.

      So finally the chart should have all the values of Five Text Boxes ,So i think to pass the values of Text boxes dynamically we need to use either Javascript or DOJO.

      Please let me know your thoughts and reply back if you need some more information.

      Thanks.

      • makvell
        makvell
        269 Posts
        ACCEPTED ANSWER

        Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

        ‏2013-04-19T07:10:12Z  in response to Raj4All

        Well, it's simple :)

        Make your coach view (container), put there five text box and chart. All logic you need write on javascript in that container. In that container coach view you can get a childs coach views, and hence their values.

        • Raj4All
          Raj4All
          77 Posts
          ACCEPTED ANSWER

          Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

          ‏2013-04-19T07:26:10Z  in response to makvell

          Hi,

          I am working on this now in IBM BPM 8.0.1 and in Heritage Coaches i am able to read data of Text Boxes through

          dojo.byId("ID_VAL").value; But when i use the same snippet in Coach View or in a Simple Coach the Logic is Failing.

           

          Some sample Code Snippet Used in Both HC and CV with the Event Handler attached for the Textboxes (Price ,Quantity) is  onKeyUP for an trial which has Price , Quantity Text Boxes as a result gives a Total in Total Text Box:

          <script>
          function updateTotal()
          {
              alert("in updateTotalmethod()");
              var price = dojo.byId("price").value;
              var quantity= dojo.byId("quantity").value;
              alert( price * quantity);
              dojo.byId("total").value = price * quantity;
          }

          </script>

          • Raj4All
            Raj4All
            77 Posts
            ACCEPTED ANSWER

            Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

            ‏2013-04-19T14:05:21Z  in response to Raj4All

            Hi All,

            Can any body give some update on this.

            Thanks.

            • dominik_
              dominik_
              11 Posts
              ACCEPTED ANSWER

              Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

              ‏2013-04-29T14:15:34Z  in response to Raj4All

              Hi,

              first of all it might be a good idea to take a look at short intro about differences between Heritage Coaches and new Coaches in BPM v8.

              http://pic.dhe.ibm.com/infocenter/dmndhelp/v8r0mx/index.jsp?topic=%2Fcom.ibm.wbpm.wle.editor.doc%2Fbuildcoach%2Ftopics%2Fclegacy_vs_view.html

              Basically the id of the coach view is saved in data-viewid attribute, so dojo.byId won't work anymore.

              If you would like to find the specific nested coach view you need to use the following syntax:

              var elementToFind = dojo.query("*[data-viewid=\"" + this.context.viewid + "\"]")[0];

              But this still is not the object you can get text data from (as input text boxes are in fact nested inside of it).

              Take a look at Neil's Kolban book on BPM - Chapter "Custom JavaScript in Coach Views" as it explains it very well.

              • Raj4All
                Raj4All
                77 Posts
                ACCEPTED ANSWER

                Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

                ‏2013-04-29T19:45:33Z  in response to dominik_

                Hi,

                Can you just share a short working example on this using Coach Views if possible and please share some more links.

                Thanks.

              • sierrapto
                sierrapto
                3 Posts
                ACCEPTED ANSWER

                Re: How to access Pallette components(TextBox,TextArea,DropDown etc) using Javascript and DOJO

                ‏2014-12-16T16:58:43Z  in response to dominik_

                Hi dominik_

                I can´t access to the value of the different elements of a coach view..

                For example, I find the element by dojo.query:

                var elementToFind = dojo.query("*[data-viewid=\"" + viewid + "\"]")[0];

                but I don´t know how to get the value of the textbox..

                I have seen in the kolban book but I don´t understandt it.

                Please can you help me with this?

                Really, I need to sum amount column values defined inside a coach view table and to update a textbox with the total.

                I have tried many things but it is impossible...

                thankiu