Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Refresh a display object

Questions related to using nuBuilder Forte.
Post Reply
nathan
Posts: 40
Joined: Tue Apr 19, 2022 9:18 pm
Been thanked: 3 times

Refresh a display object

Unread post 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.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Refresh a display object

Unread post 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
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Refresh a display object

Unread post by kev1n »

Did that help?
nathan
Posts: 40
Joined: Tue Apr 19, 2022 9:18 pm
Been thanked: 3 times

Re: Refresh a display object

Unread post by nathan »

Yes thank you ...
Post Reply