Handle Arrays action: support more than 1 char?

abletech 19 Apr, 2012
Hi, I'm using the Handle Array action, for sending in mail and saving to database a checkbox group result.

I would like to use ", " as delimiter, but I see that when saved is limited to 1 char.

See this example: my checkbox group have values FIRST_VALUE, SECOND_VALUE, THIRD_VALUE, and so on.

If I use "," as delimiter, I have this output:

FIRST_VALUE,SECOND_VALUE,THIRD_VALUE

Instead, this would be more easy to understand by the mail receiver:

FIRST_VALUE, SECOND_VALUE, THIRD_VALUE

I know that I could to this with custom PHP code, but I'm simple proposing to extend delimited to more that 1 chars.

Thank you
Stefano Bagnatica
Able Tech S.r.l.
GreyHead 19 Apr, 2012
Hi Stefano,

There is no limit on the separator - I can use '# # # # #' for example. I can also use ', ' - that works OK for me here.

Bob
abletech 19 Apr, 2012
I don't know why it works for you, but I found the problem of removed the space, and is not ChronoForms related, in fact is a Joomla limitation.

When creating the JParameter object from INI-format parameter string:
$aparams = new JParameter($action_data->params);


It does a "trim" for each parameter... see line 138 of /libraries/joomla/registry/format/ini.php (Joomla 1.5.23):
$line = trim($line);


So, the space is removed, and stays only the comma.

Anyway, thank you for the answer, I think that nothing should be done at ChronoForms side.
GreyHead 19 Apr, 2012
Hi abletech,

I had another dig around to see if I could work out what is happening. The HandleArrays use of JParameter doesn't call LoadINI as far as I can see; the parameters are in a JSON string and are decoded with json_decode in libraries/joomla/registry/format/json.php

Here's the jSON string that I see
$data: {"delimiter":", ","skipped":""}


Not vital stuff, I was just curious about why I was preserving the space and you aren't. This is Joomla! 2.5.4.

Bob
abletech 10 May, 2012
Hi Bob, I checked with another site, and this is the difference: in Joomla 1.5 parameters (params column) are saved in INI format:

form_mode=advanced
form_method=post
...

Instead, in Joomla 2.5 they are saved in JSON format:

{"form_mode":"advanced","tight_layout":"1"}

Thank you
GreyHead 12 May, 2012
Hi abletech,

OK- that explains it - thank you :-)

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