When a subform is saved I want to update a couple fields [that are not in the subform] for that record row in the DB. To do this I need the primary key for that subform row. I've added the code in the "After Save" Section Of the "Edit Code" for that form. To get the primary I'm querying the database.
I was wondering if there was a better way to get the primary key of the subform row in the "After Save".
Like we do for the forms using Hash Variable / $_POST [#recordID# / $recordID]
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.
RecordId For Subform Rows
Re: RecordId For Subform Rows
hunt342,
This is the main place you can't use hash variables.
The simple reason is that hash variable values are inserted into the PHP code just before it is run (making them static)
Here's a bit of code that prints out results to the table zzsys_trap (I created it from he invoice form in the sampledebtors screen)...
I hope this helps..
Steven
This is the main place you can't use hash variables.
The simple reason is that hash variable values are inserted into the PHP code just before it is run (making them static)
Here's a bit of code that prints out results to the table zzsys_trap (I created it from he invoice form in the sampledebtors screen)...
Code: Select all
$subformname = "FMinvoice_item";
$rows = $_POST["rows" . $subformname];
nuDebug($rows);
for($i = 0 ; $i < $rows ; $i ++){
$fieldname = 'FMinvoice_item' . substr('000'.$i, -4) . 'tri_amount';
nuDebug($fieldname . ' ' . $_POST[$fieldname]);
}
Steven