Page 1 of 1

Populate value in field from another Form

Posted: Sun Sep 25, 2022 6:53 am
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

Re: Populate value in field from another Form

Posted: Sun Sep 25, 2022 9:34 am
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);
    }

}

Re: Populate value in field from another Form

Posted: Sun Sep 25, 2022 10:14 am
by vanman
Thanks Mate. Worked great.