Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Adding via iframe

Questions related to using nuBuilder Forte.
Post Reply
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Adding via iframe

Unread post by GlenMcCabe »

New to Nu builder and PHP. I am trying to develop a simple application with parent files and child files. I can display all the required child records in an iframe but when I try to add a new one I cannot work out how to get the parent record id into the foreign key field in the new record. I create records with 0 in the foreign key field.
admin
Site Admin
Posts: 2829
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 30 times

Re: Adding via iframe

Unread post by admin »

GlenMcCabe,

Hopefully, this will help...

https://www.youtube.com/watch?v=fC4InxO ... ck&index=2


Steven
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Adding via iframe

Unread post by GlenMcCabe »

Thanks. Found this just before bedtime. About to give it a try.
GlenMcCabe
Posts: 114
Joined: Sun Sep 29, 2019 12:40 pm

Re: Adding via iframe

Unread post by GlenMcCabe »

Unable to get this to work. I have a patient table with a main index patid. I have a referral table with many referrrals per patient and a field patientID to hold the relevant patid. I have an iframe which lists the referrals for the chosen patient. I have added this iframe on the main patient detail tab. Lists referrals for patient correctly. Also tried on a seperate tab and works properly. When I choose to edit an existing referral everything is fine. When I add a new referral I cannot automatically get the patid to populate the patientID. I can type in the patientID and this works fine.

I have tried the following pieces of JavaScript and a few variations of each. A value of 0 is added to patientID.

if(!nuMainForm() && nuFormType() == 'edit') {
nuHide('patientID');

if(nuIsNewRecord()) {

$('#patientID').val(parent.nuform.getcurrent().record_id).change();

}
}

-----------------------

if (nuFormType() == 'edit') {
// get value of patient id
var holdid = $("#patid", window.parent.document);
// assign the value to referral patientid
$("#patientID').val(holdid.val()).change();
}
kev1n
nuBuilder Team
Posts: 4581
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 536 times
Contact:

Re: Adding via iframe

Unread post by kev1n »

Hi,

JavaScript is a case-sensitive language. This means that language keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

Instead of:

Code: Select all

parent.nuform.getcurrent().record_id
Write:

Code: Select all

parent.nuFORM.getCurrent().record_id
joecocs
Posts: 67
Joined: Wed Jul 04, 2018 4:11 pm
Location: France

Re: Adding via iframe

Unread post by joecocs »

Hello,
kev1n wrote:

Code: Select all

if(!nuMainForm() && nuFormType() == 'edit') {
nuHide('patientID');

if(nuIsNewRecord()) {

$('#patientID').val(parent.nuform.getcurrent().record_id).change();

}
}
amazing it works for me.

Conversely, I would like to retrieve the value of $('#patientID').val to assign it to a record field $('#TmpID').val which is in the main form

if you have an idea for syntax !

Thank's
Post Reply