How do I change the text for Add New button?

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

How do I change the text for Add New button?

Post by KSan » 2013-06-15 23:07

I have a strange need to change the text for Add New button which you see at the top of a table view. I need to change this only for one table and not the whole application. I searched and searched and could not find where that button is defined. I appreciate any pointers you might have. Thanks much!!!

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How do I change the text for Add New button?

Post by a.gneady » 2013-06-17 23:45

It's defined, as is the case with all the text in the users' area, in the "language.php" file .. Look for the line beginning with

Code: Select all

$Translation['Add New']
But if you change it in there, you'd affect all tables .. so, to change it for just one table, you could make the change in the tablename_init() hook function for the concerned table:

Code: Select all

// change the text value below
global $Translation;
$Translation['Add New'] = 'Add new text for this table only';
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: How do I change the text for Add New button?

Post by KSan » 2013-06-18 03:22

Great!!! The hook solution is even better than hunting down the place where Add New is defined as it will persist future builds and updates. Wonderful. Thanks much for your help.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: How do I change the text for Add New button?

Post by shasta59 » 2013-06-19 22:47

I use this method for a number of changes to really customize some of the screens etc. I also use a similar method on a 'settings screen' (as I call it) where the admin or others can change certain values relating to a number of factors.

This way there is no need to write a hook or change a hook. My 'hook' is done using a settings file for each member (think table in database). That way they can change things like # of items in the table view, play with some colours and much much more and it persists from session to session for them. For admin level people there are additional parameters they can set which affect the entire site.

My end goal is to not have to attend to the site by giving a certain level of control to end users/admins and getting out of the picture. When I have time I will post my code for the setting file system I am using. (Not sure when that will be as I am very busy umpiring baseball right now and other summer type of stuff).

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: How do I change the text for Add New button?

Post by a.gneady » 2013-06-20 15:29

That sounds like a very interesting idea, Alan ... I'll consider adding some variation of this in the next release.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: How do I change the text for Add New button?

Post by shasta59 » 2013-06-20 18:23

Ahmad

I would suggest allowing the following for all users (this is based upon my users feedback). I do this per table - this may seem huge but is not as the average user does not get to see all the tables anyway.
1. time out before being auto logged out - I allow them to pick any number between 10 minutes of no activity to 60 minutes
2. # of items shown in the table view
3. new record either on separate or same page under table view
4. Sorting of table view items by a limited set of columns and either asc or desc. (I usually give them 3 auto sort choices for the table view)
5. Highlight colours - can never please everyone so this way they can pick
6. Records per page in table view

For admins:
Basically most options which can be set by changing a setting in the your_tablename_view.php file and others. I even have settings changes for some of the premade text as found in language.php file. ($Translation)

It may seem daunting with a lot of options but a lot of them are set and forget. If they are not set the default values apply.

On another note I have just about finished my tracking system. This tracks record changes table by table and by user so that it can be determined who changed what and when in case the need comes up to know such information. You can then view an entire list of who made what changes to what table data and when etc. Is more than just data modified and by what user.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

KSan
AppGini Super Hero
AppGini Super Hero
Posts: 252
Joined: 2013-01-08 20:17

Re: How do I change the text for Add New button?

Post by KSan » 2013-06-21 18:44

Great discussion! Can't wait to see Alan's code and/or Ahmad's changes. Thanks much to both of you!!!

mgain2013
Posts: 29
Joined: 2013-02-16 16:12

Re: How do I change the text for Add New button?

Post by mgain2013 » 2013-10-01 16:56

I need to change the "Save New" on The Detail View (Form Page), where would I do that? I only need it on certain pages not globally. Any help would be greatly appreciated.

Thanks
Michael

hinoue
Posts: 5
Joined: 2022-05-12 07:14

Re: How do I change the text for Add New button?

Post by hinoue » 2023-05-19 23:55

Any way to get the same label change done for the Add New button on a child table?

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: How do I change the text for Add New button?

Post by pbottcher » 2023-05-20 16:46

The Child table uses the same Tablename-dv.js as if would the the standalone table. So you can add your code there.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

hinoue
Posts: 5
Joined: 2022-05-12 07:14

Re: How do I change the text for Add New button?

Post by hinoue » 2023-05-21 03:20

For some reason, it's not changing the existing Add New button's label for the child table when I add the following in the tablename_init() function in the hook php file...

global $Translation;
$Translation['Add New'] = 'Add new text for this table only';

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: How do I change the text for Add New button?

Post by pbottcher » 2023-05-21 08:36

Hi,

you need to use the translation for Save New, not Add New :-)

$Translation['Save New'] = 'Add new text for this table only';
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

hinoue
Posts: 5
Joined: 2022-05-12 07:14

Re: How do I change the text for Add New button?

Post by hinoue » 2023-05-21 15:21

I tried $Translation['Save New']. While a subsequent window that shows up after pressing the "add new" button shows the text properly, I am still not able to change "Add New" button that shows up for the child table.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: How do I change the text for Add New button?

Post by pbottcher » 2023-05-21 17:43

ok, if you are looking for the Add New at the child table, this can only be changed dynamically via the tablename-dv.js (warning, the child table is loaded afterwards, so you need to wait until is show up before update.

As alternative you could also edit each templates/children-TABLNAME.php file where TABLENAME is the name of the child table. In there you search for the $Translation['Add New'] and replace it with whatever suits you. !! Warning, this file gets overwritten once you regenreate your application.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply