Hi,
I've been using Appgini Helper to automatically create a new record in the child-table base on the parent-table but it can't automatically save the record to the child-table.
Is it possible to do that using Appgini Helper?
Thanks
Automatically save record to child-table
Automatically save record to child-table
Regards,
Edix
Edix
Re: Automatically save record to child-table
Hi,
probably Jan will post a much better answer than I can.
As AG Helper is JS, it's "frontend". I do not know of any function that would allow submitting the record.
You could however use JS yourself and create a function that submits the form in the same way the submit button does.
I am not even sure what you mean by you let AG Helper create a new record. Would it make more sense to let PHP create a new record instead?
Olaf
probably Jan will post a much better answer than I can.
As AG Helper is JS, it's "frontend". I do not know of any function that would allow submitting the record.
You could however use JS yourself and create a function that submits the form in the same way the submit button does.
I am not even sure what you mean by you let AG Helper create a new record. Would it make more sense to let PHP create a new record instead?
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Automatically save record to child-table
Hi Olaf.
This is the additional parameter for the action button from the Appgini Helper JS library.
Here is the link:
https://appgini.bizzworxx.de/appgini/ap ... n-buttons/
The code work perfectly, I just wonder is there some other code to extend this functionality to save the record as well.
Thanks
This is the additional parameter for the action button from the Appgini Helper JS library.
Code: Select all
var id = dv.getSelectedId();
var href = "tasks_view.php?addNew_x=1&filterer_calculation_id=" + id;
https://appgini.bizzworxx.de/appgini/ap ... n-buttons/
The code work perfectly, I just wonder is there some other code to extend this functionality to save the record as well.
Thanks
Regards,
Edix
Edix
Re: Automatically save record to child-table
Hi devedix,
thanks for letting me know. Great to hear, that it works now.
I am not sure what you are doing - ok, it seems, you are calling the page to add a new record - but does it also have some content?
I do not understand, why you are using (or want to use) AG Helper to add a new record (I assume it does hold some content) instead of going the backend way using PHP:
You could use the AG Helper function to call your own PHP script which then inserts a (the) new record into the database and after inserting, returns to your parent record (which will show the new child in the child-registers).
Olaf
thanks for letting me know. Great to hear, that it works now.
I am not sure what you are doing - ok, it seems, you are calling the page to add a new record - but does it also have some content?
I do not understand, why you are using (or want to use) AG Helper to add a new record (I assume it does hold some content) instead of going the backend way using PHP:
You could use the AG Helper function to call your own PHP script which then inserts a (the) new record into the database and after inserting, returns to your parent record (which will show the new child in the child-registers).
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Automatically save record to child-table
Hi Olaf,
I use the AG helper because the code is so simple, and yes it does have the content I need.
Jan is making an awesome plugin and I really like it.
What I'm doing is auto-create a record in the child-table with the content from the parent table, It has many auto-fill fields that can be created directly from the parent-table.
Btw, I have one more question.
How can I update the value of a field and change the owner of the record from a button?
I try to write an ajax file with this code:
But I don't know how to run it with javascript.
Jan also have this button for executing js but I don't know how to load the ajax file.
Can you help?
Thanks
I use the AG helper because the code is so simple, and yes it does have the content I need.
Jan is making an awesome plugin and I really like it.
What I'm doing is auto-create a record in the child-table with the content from the parent table, It has many auto-fill fields that can be created directly from the parent-table.
Btw, I have one more question.
How can I update the value of a field and change the owner of the record from a button?
I try to write an ajax file with this code:
Code: Select all
?php
$currDir = dirname(__FILE__). '/..';
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
/* grant access to all users who have access to the orders table */
$od_from = get_sql_from('truckingJobfile');
if(!$od_from){
header('HTTP/1.0 401 Unauthorized');
exit;
}
$id = intval($_REQUEST['id']);
if(!$id) exit;
sql(" update truckingJobfile set closed='true' where jfID='{$id}'", $eo);
set_record_owner("truckingJobfile", $id, "admin");
Jan also have this button for executing js but I don't know how to load the ajax file.
Code: Select all
// file: patients-dv.js
var dv = AppGiniHelper.DV;
var actionbuttons = dv.actionbuttons;
var group = actionbuttons.addGroup("Additional Buttons");
group.addButton("Click me!", function () {
alert("Clicked!")
});
Thanks
Regards,
Edix
Edix
Re: Automatically save record to child-table
Hi,
sorry, can not help here.
Olaf
sorry, can not help here.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Automatically save record to child-table
Hi Edix,
See viewtopic.php?t=4051 for an example of how to call an ajax script. If you google "appgini ajax" for instance, you can get a listing of such forum posts (and more).
Totally agree that the Helper JS library is great but like Olaf said, it's job is front-end and wouldn't have db APIs.
~Paul
See viewtopic.php?t=4051 for an example of how to call an ajax script. If you google "appgini ajax" for instance, you can get a listing of such forum posts (and more).
Totally agree that the Helper JS library is great but like Olaf said, it's job is front-end and wouldn't have db APIs.
~Paul
Re: Automatically save record to child-table
Hi,
talking about an API for AG, you should check this: https://github.com/rafinhacarneiro/appgini-api
(check out the links google returns in the forum: https://www.google.com/search?q=https%3 ... ppgini.com
Olaf
talking about an API for AG, you should check this: https://github.com/rafinhacarneiro/appgini-api
(check out the links google returns in the forum: https://www.google.com/search?q=https%3 ... ppgini.com
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: Automatically save record to child-table
Hi Paul and Olaf,
Thanks for the help, I've managed to insert the record automatically through AJAX.
Thank you very much for your kindness and willingness to help.
Thanks for the help, I've managed to insert the record automatically through AJAX.
Thank you very much for your kindness and willingness to help.
Regards,
Edix
Edix