Implement Confirm/alertbox for Submit button in Bonita 6.3.8

1
+1
-1

Hi All,

I am trying to implement a confirm/alertbox to check before submitting a form. This button is a Bonita submit button. I have very little knowledge of JS/jquery but can understand and implement through trial and error.

Is there an existing out of the box solution for this ? Or if you have any pointers please let me know.

I have referred this : http://community.bonitasoft.com/groups/usage-operation-5x/resolved-confi... , but it is for an older version and is not working for me.

The html page looks like this : ...

  1. <div id="Submit1"></div>

...

Details of this button class in bonita:

  1. div id="Submit1" class="bonita_form_button_entry"> <div class="bonita_form_button_entry"><button type="button" class="bonita_form_button">Submit Documents</button></div></div>

I tried this:

  1. <div id="Submit1" onclick="confirm('Are you sure ?')"></div>

This shows a dialog but continues the operation without waiting for my response. Thank you

Comments

Submitted by bos2013 on Thu, 11/27/2014 - 15:32

Hi,

One solution could be to implement 2 forms in the same tasks : 1) to input data/info 2) to confirm the data/info with displayed info in readonly.

User can go back to input form to change information.

Hopefully it helps

regards, LL

Submitted by anirudh on Fri, 11/28/2014 - 05:10

Thank you very much LL. That should definitely be a patch work for now. However I wish there was a one line solution like I am trying. I mean the above feature works in any html but just not in the bonita portal.

Submitted by bos2013 on Fri, 11/28/2014 - 09:41

Finally, maybe having a look to this chapter in the blog : How to add custom Javascript in your Bonita BPM Forms http://community.bonitasoft.com/blog/how-add-custom-javascript-your-boni...

Good luck for the implementation.

Submitted by anirudh on Fri, 11/28/2014 - 10:02

Hi bos2013 . No that was not helpful , I have already gone through that.

I appreciate your help though.

1 answer

1
0
-1

Hello,

I had the same problems: customizing the confirm just does not work.

However, you can customize the process template and check for a task list. This is rather tricky though because the tasks are added by script and you cannot ensure your scripts runs last! So you have to set a time out on your script.

E.g. my script for automatically running the next user task involves

  1. <script type="text/javascript">
  2. var delay = 2000;
  3. history.navigationMode = 'compatible';
  4. $(document).ready(function () {setTimeout(function(){ActivateNextTask();}, delay);});
  5.  
  6. function ActivateNextTask() {
  7. if (window.console) console.log('Checking for presence of user tasks ...');
  8. var taskElement = $('div.bonita_form_task_link');
  9. if (taskElement.length == 0)
  10. {
  11. if (window.console) console.log('No user task found');
  12. }
  13. else
  14. {
  15. if (window.console) console.log('Automatically activating task ' + taskElement.text());
  16. taskElement.click();
  17. }
  18. }
  19. </script>

However this code does not work if the user is returned to this page after a gateway, because the script isn't rerun. Using other events (pageshow, load, ...) does not work either,and the caching cannot be modified because of how the template injection works ...

Anyway, this may help you move ahead

Notifications