Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
Adding via iframe
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Adding via iframe
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.
Re: Adding via iframe
GlenMcCabe,
Hopefully, this will help...
https://www.youtube.com/watch?v=fC4InxO ... ck&index=2
Steven
Hopefully, this will help...
https://www.youtube.com/watch?v=fC4InxO ... ck&index=2
Steven
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
-
- Posts: 114
- Joined: Sun Sep 29, 2019 12:40 pm
Re: Adding via iframe
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();
}
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();
}
-
- nuBuilder Team
- Posts: 4307
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 448 times
- Contact:
Re: Adding via iframe
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:
Write:
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
Code: Select all
parent.nuFORM.getCurrent().record_id
-
- Posts: 67
- Joined: Wed Jul 04, 2018 4:11 pm
- Location: France
Re: Adding via iframe
Hello,
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
amazing it works for me.kev1n wrote:Code: Select all
if(!nuMainForm() && nuFormType() == 'edit') { nuHide('patientID'); if(nuIsNewRecord()) { $('#patientID').val(parent.nuform.getcurrent().record_id).change(); } }
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