Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Custom Save Messages for tables

Custom Save Messages for tables 24 Jan 2016 13:46 #13769

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 16
When I save a record in a certain table (i.e not ALL saves) I want a custom save message to appear. It appears the system uses the default

JLIB_APPLICATION_SAVE_SUCCESS

language string, even though it does not actually occur in the component.

How can I change this message based on the table being updated as I want to add some extra follow on instruction when a user creates a new record for a certain table

Thanks
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 10:22 #13773

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This is in the language file.

I saw it already, but now I am working on the pure version, and the languages string are all rewrited in sligtly different way.
To fix this problem, I recommend you to add this Joomla native string. Maybe it has dissareared. Must check more.
Coding is now a piece of cake
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 10:51 #13775

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This string is written in :
en-GB.lib_joomla.ini

Two possible cases :
- Joomla lang file is not loaded at that moment.
- The string if build with an extra character or escapement that you don't see, but make the problem happening.

I have not searched more, where this message is raised, or constructed on the request. This should be Joomla native I think.
I saw some components (com_messages) wich copy thoses system strings in copy. It is an heresy, and maybe cook should do the same. But as far as I know it has always worked, so I can't see the problem.

I must dig your case.
Can you tell me wich PTL ?
Coding is now a piece of cake
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 13:42 #13780

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 16
Oh I can change the default using an override no problem

What I am trying to do is a custom message tied against a table.. I.e table called RECORD the customs message would be 'Ypur record has been saved, thank you for taking the time to complete this information' but in the SAME component a table called PROFILE would out put 'Your profile record has been added'

So different message for each model save function? Make sense?
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 14:09 #13781

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
Hi,

You can fork the controller and copy the save function in it.

Then add:
$this->setMessage(JText::_('Custom save message'));
just behind
$this->_result = $result;

Probably does the trick you need.
Last Edit: 26 Jan 2016 14:10 by Romkabouter.
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 14:20 #13782

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
And if you build it correctly, you put this fork (or similar) in the superclass controller. So it does apply on all controllers.

The FOF way is similar to what you try to achieve.

There is two different ways :
- concat the result string AFTER 3 translations (begin, middle, end)
- concat the language key, and define every single translation. (better way, FOF way)
Coding is now a piece of cake
The administrator has disabled public write access.

Custom Save Messages for tables 26 Jan 2016 14:21 #13783

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
The best is also to use the pluralization in some cases. (to manage the case of many items, it speaks in plural)

Maybe Joomla does it I don't remember. Confused with FOF sometimes.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.218 seconds

Get Started