An issue with jQuery, simple button and hidden fields.

1
0
-1

Hello commrades! I have an issue with binding action on a simple button in Bonita BPM Studio (also there is another issue with hidden fields).

All actions are performed with BonitaForm.html file in C:\%path_to_Bonita%\workspace\tomcat\bonita\client\platform\tenant-template\work\theme\portal and of course in the program.

In Studio I have added Html widget, Hidden Field, Simple Button to the form with submit button. I'm trying to access the process variables through the JavaScript. But unfortunately, even a simple bind action on button does not work. I added a new class name to Simple Button "createSpec" at Form Builder -> Appearance -> Field *for easy accessing to element. Since jQuery is already connected in the file BonitaForm.html, I put the jQuery code into the Html Widget (for some reason code refused to work when it is in file and connected in of BonitaForm.html*). So here are the code:

$(document).ready(function () {
    $('.createSpec').find(':last').click(function () {
        alert("RUNNING");
    });
})

The following jQuery code [ http://jsfiddle.net/27Rf5/ ] is not working in Bonita when I running the process, but it works in simple .html file that I created and, as you see, in jsfiddle site.

What I've tried to:

  • Put the jquery code into simple Button options, but it's not working

  • Change jQuery code to

$(document).ready(function () {
    $('#SimpleButton1').click(function () {
        alert("RUNNING");
    });
})

And this works, but it binds the area line in browser instead of button.

What should I change?

And another question: To access the process variables through javaScript I should use Hidden field with binded String process variable to it. In javascript code I should access the Hidden field value by ID and then send to it value fro JS variable. But what should I do if I have a list of values that can dynamically change? In this case I can't add Hidden Fileds, because I simply don't know how much I will require them.


I am using Bonita BPM Studio Community 6.2.5, Java 7u51, Windows 7 x64

Regards, Igor

1 answer

1
0
-1

Hello Ozzoid, I have faced the same problem recently.

My suspicion is : the "$(document).ready(function () {" is not working as you are expecting.

The Portal builds and loads the page by blogs and some of them are loaded with and AJAX call.

I still haven't gone deeper to understand how it works buy I will try it in the next days.

In the mean while... could you please try and change

$(document).ready(function () {

for this:

$('#SimpleButton1').ready(function () {

Let me know if this fixes your problem or helps somehow.

Cheers, Jordi

Comments

Submitted by sfreue on Sun, 06/29/2014 - 02:40

I've had a similar problem, and after scratching my head for a while I moved the HTML Widget with the .change(... to the bottom of the form and it started working.

Hope it helps,

Sergio

Notifications