Forums

Server-side validation and language strings

adop 10 Jun, 2012
Hi Bob,

I am trying to get the language strings translated for server-side errors. I have checked the code in auto_serverside_validation and see for example the string:
'not_empty_error' => 'This field should NOT be empty.'
I have tried to translate not_empty_error in various ways but cannot find the right one. Can you give me a hint please.

Thanks,
adop
Max_admin 10 Jun, 2012
Hi adop,

Just translate this string using a "Multi language" action:

This field should NOT be empty=XXX XXX XXXXX XX


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
adop 13 Jun, 2012
Thanks Max,

that was too simple for my twisted mind. I have another question of the same type.

I am building a list with a custom code action that feeds a DB Multi Record Loader because I want to use the Data Displayer but and I cannot figure out how to set up the translation.
If I use the Multilanguage action the translation takes place before the data is used to produce the list by the Loader and hence since this one has constant strings like CS_GROUPNAME in the "Display Fields" field it gives me an error because it finds CS_GROUPNAME's translation.

I have tries to use custom code in View Mode but no result.

Can you point me in the right direction?

Thankx,
adop
GreyHead 14 Jun, 2012
Hi adop,

Please make sure that you are using a Custom Code action (not a Custom Code element in the Preview tab) to prepare your data and that the Mode is set to Controller, not to View. This should make sure that the processing is done before the Multi-Language actions run.

Bob
adop 15 Jun, 2012
Hi Bob,
I am using the configuration that you suggest but the issue is still here. In details I have a form with:
no elements in preview;
3 action in the On Load event:
1) DB Multi Record Loader where I run this query
SELECT id,title from #__content
In Data Displayer / Display Fields I have
id:id,title:title

2) Multi Language - it-IT with these 2 strings:
id=ID
title=Titolo

3) Show HTML [GH]

If I run the list with this configuration for each extracted record I get 2 error messages:

Notice: Undefined index: ID in ...cfaction_db_multi_record_loader.php on line 77
Notice: Undefined index: Titolo in .... cfaction_db_multi_record_loader.php on line 77


If I take the Multi Language - it-IT action out all the records are displayed but no translation for column headers.
In the actual form I load the array $form->data['cf_data'] from custom code so I guess I could always get the translation strings processed there with a JText function but I would prefer to use CF features.

Regards,
adop
adop 15 Jun, 2012
I have solved it.
Basically I was getting CF confused by using column header titles equal to MySQL column names.
Changing
id:id,title:title
to
id:MY_ID,title:MY_TITLE
and
id=ID
title=Titolo
to
MY_ID=ID
MY_TITLE=Titolo
solved the issue.

Regards,
adop
GreyHead 15 Jun, 2012
Hi adop,

Excellent, Bravo! :-)

Bob
This topic is locked and no more replies can be posted.