Page 1 of 1

Refresh a display object

Posted: Wed Jun 15, 2022 7:56 pm
by nathan
Hello it's me again with another silly question :hi: :D :oops: :oops:

On Form 1 I have a display object "mb_status" which displays the current status of a member. I also have a run button that opens form 2 in a popup browse mode containing the history of status changes. I use the add button to add a new status change. After save I update the database with the new status and closed form 2 and returned to form 1 in edit mode.
I would like to update the information in the display object "mb_status" without having to manually refresh the page.

Re: Refresh a display object

Posted: Thu Jun 16, 2022 4:46 am
by kev1n
Hi,

In the popup form, add an nuAfterSave() function that is triggered when the form is saved.
nuIsIframe() checks if the form is opened in an iframe/popup and with parent.nuGetProperty('form_id') you check if the parent form has a certain id.
Then nuRefreshDisplayObject() is used to refresh a Display Object on the parent form with Id (e.g.) displayId

Code: Select all

function nuAfterSave() {

    if (nuIsIframe() && parent.nuGetProperty('form_id') == '6284eafb9392780') {  // <--- replace with your form id
        parent.nuRefreshDisplayObject('displayId'); // <-- replace with you display id
    
    }

}
BTW, the previous Github version contained a faulty nuRefreshDisplayObject() function. You might have to pull the latest https://github.com/nuBuilder/nuBuilder-4.5/blob/master/core/nuform.js with the patched version

Re: Refresh a display object

Posted: Mon Jul 18, 2022 8:51 pm
by kev1n
Did that help?

Re: Refresh a display object

Posted: Sun Jul 24, 2022 11:21 pm
by nathan
Yes thank you ...