JavaScript handler to update the data of the multiple choice field to include any newly added tags.

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

JavaScript handler to update the data of the multiple choice field to include any newly added tags.

Post by fgazza » 2020-02-21 13:42

Hi everybody.
I hope someone can help me:
I have an "activity" table with an "employee" field. The "employee" field is a multiselect field that takes the employees registered in the "employee_name" field of the "human_ resources" table.
When a new record is inserted in the "human_resources" table, a script updates the "cs_employee_activity" file by adding the name of the new employee to the .csv file.
This allows me to insert new employees in the "employee" field of the "activity" table as new records are inserted in the "human_ resources" table.

I created an "add employee" link in the "activity" table that allows you to open the "human_resources" table in a "add record" mode in a separate window (the link is http: //mywebsite.ext/human_resource_view.php? AddNew_x = 1).

And here's my problem:
I need that after creating the new record in the "human_ resources" table, on closing the modal window (by the add new button) a JavaScript handler would update the data of the multiple choice field to include any newly added tags.

My post is related to the blog post A work-around to implement a multiple choice lookup field in your AppGini apps” see link: https://bigprof.com/blog/appgini/a-work ... gini-apps/

Thank you very much!

Fabiano


fgazza
Veteran Member
Posts: 205
Joined: 2019-04-30 17:37

Re: JavaScript handler to update the data of the multiple choice field to include any newly added tags.

Post by fgazza » 2020-02-22 06:31

of course! I realized that I wrote something wrong in the post:
I wanted to write: When a new record is inserted in the "human_resources" table, a script updates the "employee_activity.csv" file by adding the name of the new employee to the .csv file.
My problem is precisely:
I open the activity table and want to add a new employe. So I create the link http: //mywebsite.ext/human_resource_view.php? AddNew_x = 1 in the activity table which allows me to add an employe_name in the human_resource table (in a modal window). I need that after creating the new record in the "human_ resources" table, on closing the modal window (by the add new button) a JavaScript handler would update the data of the multiple choice field in the activity table to include any newly added tags .

shkdxb
Veteran Member
Posts: 40
Joined: 2013-06-28 18:18

Re: JavaScript handler to update the data of the multiple choice field to include any newly added tags.

Post by shkdxb » 2020-02-23 04:09

try the function , human_ resources_before_insert() and human_ resources_before_update() inside human_ resources.php (inside hooks folder)

there is an example how to open and log entries to an logfile here -->https://bigprof.com/appgini/help/advanc ... ter_delete

you can modify this to enter your values to employee_activity.csv file when you add /update a new employee to human_ resources table

Post Reply