The CreatorCon Call for Content is officially open! Get started here.

Issue with the Bootstrap Modal

Srinivas_S
Tera Contributor

Hi Everyone!

 

I'm using Bootstrap for modal pop-ups (in the widget),  I have implemented a few fields as a form and that form itself is a modal. The issue is that by default we have the data/value in the field gets saved once submitted. If I try to click Add button for the next modal the same data in the fields would be displayed (the same modal gets displayed by default).

 

Now when I try to manually clear fields and try to add new values and submit, the values are displaying in multiple. 

 

For a scenario if I have the choice field country with options a,b,c (sn-record-picker) and if I select 'a' and submit, the 'a' is getting updated on the multi-row variable set(not of record producer) under country but if I click Add button for new modal, the same modal is getting opened with same values in the fields. Now if I try to clear and select 'b' and submit, the initial 'a' is getting replaced with 'b', and also one more row is added with 'b' and the output is two 'b's. 

 

Kindly could anyone help me related to the updation of the previous value to the new value automatically so that I can avoid duplicity of the values after entering new values?

 

5 REPLIES 5

Joe72
Tera Contributor

Unfortunately, all of the default bootstrap modal events do not work in ServiceNow. It looks like they encapsulated the functions and prevent the events from bubbling. There are a couple events that do work, but after tinkering with them, they are not reliable ("focusin.bs.modal", etc).

 

The best bet is to use the callback functions of spModal and $uibModal respectively.