Welcome to the nuBuilder Forums!

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

Populate value in field from another Form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Populate value in field from another Form

Unread post by vanman »

Hi

I click a button on a organisation form to open a nuPopUp which opens a new Project form.

The Project form has various fields including a readonly pro_org_id field which I want it to be populated with the Primary Key of the organisation.

Call form
Onclick Button

Code: Select all

var id = event.target.parentNode.id;
var pk = $('#' + String(id)).attr('data-nu-primary-key');
nuSetProperty('#pkorg_id#', pk);
console.log('pkorg_id: ', pk);
nuPopup('632eee870d9fd44','-1');
How do I populate the pro_org_id field on the new Project form?

I notice in BE I can call the '#pkorg_id#' HASH but not in BS or AS.

Thanks for your help.

Paul
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: Populate value in field from another Form

Unread post by kev1n »

Hi,

In the popup's custom code, retrieve the Hash Cookie and populate the lookup.

Code: Select all

if (nuIsNewRecord()) {

    var pk = parent.nuGetProperty('filter_client_id');

    if (pk !== undefined) {
        nuGetLookupId(pk, 'pro_org_id', false, false);
    }

}
vanman
Posts: 54
Joined: Thu Mar 01, 2018 11:09 pm
Has thanked: 1 time

Re: Populate value in field from another Form

Unread post by vanman »

Thanks Mate. Worked great.
Post Reply