Topic
  • 16 replies
  • Latest Post - ‏2015-02-28T13:33:56Z by pgunapati
Raj4All
Raj4All
87 Posts

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
    15 Posts

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

    ‏2013-04-18T06:20:48Z  

    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
    10 Posts

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

    ‏2013-04-18T11:23:25Z  
    • J0n35y
    • ‏2013-04-18T06:20:48Z

    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?

    Attachments

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

    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  
    • Deepikaa
    • ‏2013-04-18T11:23:25Z
  • J0n35y
    J0n35y
    15 Posts

    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  
    • Deepikaa
    • ‏2013-04-18T11:25:11Z

    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
    87 Posts

    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  
    • Deepikaa
    • ‏2013-04-18T11:25:11Z

    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
    15 Posts

    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  
    • Raj4All
    • ‏2013-04-18T13:35:35Z

    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.

    Sorry I don't have any experience in 8.0.1

  • makvell
    makvell
    269 Posts

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

    ‏2013-04-19T06:28:02Z  

    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
    87 Posts

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

    ‏2013-04-19T06:57:57Z  
    • makvell
    • ‏2013-04-19T06:28:02Z

    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.

    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

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

    ‏2013-04-19T07:10:12Z  
    • Raj4All
    • ‏2013-04-19T06:57:57Z

    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.

    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
    87 Posts

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

    ‏2013-04-19T07:26:10Z  
    • makvell
    • ‏2013-04-19T07:10:12Z

    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.

    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
    87 Posts

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

    ‏2013-04-19T14:05:21Z  
    • Raj4All
    • ‏2013-04-19T07:26:10Z

    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>

    Hi All,

    Can any body give some update on this.

    Thanks.

  • Deepthi_Gujjar
    Deepthi_Gujjar
    3 Posts

    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  
    • Raj4All
    • ‏2013-04-18T13:35:35Z

    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.

    Use the same in inline javascript it would work there.

     

  • dominik_
    dominik_
    11 Posts

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

    ‏2013-04-29T14:15:34Z  
    • Raj4All
    • ‏2013-04-19T14:05:21Z

    Hi All,

    Can any body give some update on this.

    Thanks.

    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
    87 Posts

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

    ‏2013-04-29T19:45:33Z  
    • dominik_
    • ‏2013-04-29T14:15:34Z

    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.

    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
    4 Posts

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

    ‏2014-12-16T16:58:43Z  
    • dominik_
    • ‏2013-04-29T14:15:34Z

    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.

    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

     

     

     

  • pgunapati
    pgunapati
    18 Posts

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

    ‏2015-02-28T13:33:56Z  
    • sierrapto
    • ‏2014-12-16T16:58:43Z

    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

     

     

     

    Hi Patricia,

    Below post on how to get the text field coach view value might be helpful for your requirement.

    http://ibpmcoding.blogspot.com/2015/02/how-to-access-coach-view-element-in.html