Page 1 of 1
How do I change the text for Add New button?
Posted: 2013-06-15 23:07
by KSan
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!!!
Re: How do I change the text for Add New button?
Posted: 2013-06-17 23:45
by a.gneady
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
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';
Re: How do I change the text for Add New button?
Posted: 2013-06-18 03:22
by KSan
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.
Re: How do I change the text for Add New button?
Posted: 2013-06-19 22:47
by shasta59
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
Re: How do I change the text for Add New button?
Posted: 2013-06-20 15:29
by a.gneady
That sounds like a very interesting idea, Alan ... I'll consider adding some variation of this in the next release.
Re: How do I change the text for Add New button?
Posted: 2013-06-20 18:23
by shasta59
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
Re: How do I change the text for Add New button?
Posted: 2013-06-21 18:44
by KSan
Great discussion! Can't wait to see Alan's code and/or Ahmad's changes. Thanks much to both of you!!!
Re: How do I change the text for Add New button?
Posted: 2013-10-01 16:56
by mgain2013
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
Re: How do I change the text for Add New button?
Posted: 2023-05-19 23:55
by hinoue
Any way to get the same label change done for the Add New button on a child table?
Re: How do I change the text for Add New button?
Posted: 2023-05-20 16:46
by pbottcher
The Child table uses the same Tablename-dv.js as if would the the standalone table. So you can add your code there.
Re: How do I change the text for Add New button?
Posted: 2023-05-21 03:20
by hinoue
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';
Re: How do I change the text for Add New button?
Posted: 2023-05-21 08:36
by pbottcher
Hi,
you need to use the translation for Save New, not Add New
$Translation['Save New'] = 'Add new text for this table only';
Re: How do I change the text for Add New button?
Posted: 2023-05-21 15:21
by hinoue
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.
Re: How do I change the text for Add New button?
Posted: 2023-05-21 17:43
by pbottcher
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.