I have 3 tables:
Table1 with fields: id1, id1_id2, id1_id3, text1
Table2 with fields: id2, text2
Table3 with fields: id3, id3_id2, text3
In Form1 via id1_id2 Lookup field I insert id2 from Form2. In Form1 via id1_id3 Lookup field I want to insert New Record id3 from Form3, but I need save id1_id2 record to id3_id2.
1. In Form3 Before Open write:
$j = "
function nuLoadEdit(){
nuSetHash('id', $('#id1_id2').val());
}
";
nuAddJavascript($j);
But hash variable "id" I get undefined.
2. In Form3 field id3_id2 Default Value write #id1_id2#, but nothing.
How transfer data between forms?
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.
Transfer data between forms
Re: Transfer data between forms
Arunas,
Why not update table 3 with table 2's id on After Save?
Steven
Why not update table 3 with table 2's id on After Save?
Steven
-
- Posts: 21
- Joined: Sat Feb 07, 2015 11:19 pm
Re: Transfer data between forms
Steven,
Because I need to take other data from Table2 to Table3 (not only id) and sometimes change them before save.
I have other question. Then write in Code/PHP Procedures/PHP Code:
$s = "SELECT * FROM table";
$t = nuRunQuery($s);
$r = db_fetch_object($t);
$j = "
function nuLoadEdit(){
nuSetHash('id1', '$r->id');
}
";
nuAddJavascript($j);
and in Form Extra Action Buttons/Javascript to Run:
nuRunPHP('php_procedure','iframe');
nuGetHash('id1');
I get mistake "Fatal error: Call to undefined function nuAddJavascript() in". This code working in Form Custom Code/Before Open. How transfer data from php procedure to Form field?
Because I need to take other data from Table2 to Table3 (not only id) and sometimes change them before save.
I have other question. Then write in Code/PHP Procedures/PHP Code:
$s = "SELECT * FROM table";
$t = nuRunQuery($s);
$r = db_fetch_object($t);
$j = "
function nuLoadEdit(){
nuSetHash('id1', '$r->id');
}
";
nuAddJavascript($j);
and in Form Extra Action Buttons/Javascript to Run:
nuRunPHP('php_procedure','iframe');
nuGetHash('id1');
I get mistake "Fatal error: Call to undefined function nuAddJavascript() in". This code working in Form Custom Code/Before Open. How transfer data from php procedure to Form field?
Re: Transfer data between forms
Arunas,
One question at a time.
I still don't understand question 1 (do you have 2 Forms open at once?)
Steven
One question at a time.
I still don't understand question 1 (do you have 2 Forms open at once?)
Steven
-
- Posts: 21
- Joined: Sat Feb 07, 2015 11:19 pm
Re: Transfer data between forms
I have two systems that are bonded:
1. Vendors (Table2 - Form2), Invoices (Table3 - Form3), Invoice Details and Buyers. Each vendor have its own data, which I have take to Invoice. This system working without problem.
2. I have one type of products database with a lot of calculations (Table1 - Form1). When I get product, I insert Vendor from Table2 via Form1 lookup field. When I sell product, I have insert Buyer and Invoice (from Table3) via Form1 lookup field. But I need get and change some data from Vendor (Table2) to new Invoise record before save.
I solved so:
1. Insert new product and Vendor data via Form1 lookup field.
2. When sell product, I get from Vendor table data and write it to Form1 additional fields (it doing php code in Form1 / Before Open). Then change this data and insert to Invoice table with php code After Save (not via lookup field).
But it would be good that the data is transferred between the forms easier. For example to global hash variables. We could set a hash variable with nuSetHash in Form1 and get this variable with nuGetHash in other Forms.
1. Vendors (Table2 - Form2), Invoices (Table3 - Form3), Invoice Details and Buyers. Each vendor have its own data, which I have take to Invoice. This system working without problem.
2. I have one type of products database with a lot of calculations (Table1 - Form1). When I get product, I insert Vendor from Table2 via Form1 lookup field. When I sell product, I have insert Buyer and Invoice (from Table3) via Form1 lookup field. But I need get and change some data from Vendor (Table2) to new Invoise record before save.
I solved so:
1. Insert new product and Vendor data via Form1 lookup field.
2. When sell product, I get from Vendor table data and write it to Form1 additional fields (it doing php code in Form1 / Before Open). Then change this data and insert to Invoice table with php code After Save (not via lookup field).
But it would be good that the data is transferred between the forms easier. For example to global hash variables. We could set a hash variable with nuSetHash in Form1 and get this variable with nuGetHash in other Forms.
Re: Transfer data between forms
Arunas,
My suggestion would be After Save (like you have done) that is exactly what it should be used for.
And a lot simpler.
Steven
My suggestion would be After Save (like you have done) that is exactly what it should be used for.
And a lot simpler.
Steven