Forums

How to process custom variable

01 14 Oct, 2012
Hi!
I've created a custom multiselect element.
Now I need to process selected data and paste it into Email template...
Don't know how to make it: receive array, process(format and paste into global variable (?) ) it and paste into template . In plain php it is like this:

<?php 
$test=$_POST['test']; /*select name*/
	if ($test){
	 foreach ($test as $t)
	  {
	   echo 'You selected ',$t,'<br />';
	   }
	}
 ?>


Thank you!
GreyHead 14 Oct, 2012
Hi 01,

Please see this FAQ you need to add the Handle Arrays action to the On Submit event.

Bob
01 14 Oct, 2012
Thank you!
Here I've some difficulties. My select elements looks like this:
<select id="myList" name="adv[]" multiple="multiple" disabled='disabled' size="8">
   <option value="one">„one“</option>
   <option value="two">„two two“</option>
    ...
</select>

Also at the top of On Submit event I've added Handle Arrays where at "White fields list" I've written adv. Do I need more actions? Or now I can add data straight to template (which placeholder should I use)?
GreyHead 14 Oct, 2012
Hi 01,

A disabled input does not submit anything :-(

Please leave the White Fields List empty.

Bob
01 14 Oct, 2012
The disabled options is made for JS - so it could be omitted. The multiselect works - tested on separate php file.

"White Fields" changed to blank. Delimeter is set to default - ".", as it was.
As my custom select has "input_custom_10" field name - I've putted it to mail template with placeholders. But still no result... I receive mail with this line:

{input_custom_10}

GreyHead 14 Oct, 2012
Hi 01,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob
01 14 Oct, 2012

Hi 01,

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

Bob


No problem, here it goes:



Warning: preg_match() [function.preg-match]: Unknown modifier 'n' in /var/www/vhosts/xxx.com/httpdocs/administrator/components/com_chronoforms/form_actions/custom_serverside_validation/custom_serverside_validation.php(18) : eval()'d code on line 6
Data Array:

Array
(
    [option] => com_chronoforms
    [tmpl] => component
    [chronoform] => Zakaz_reklamy
    [event] => submit
    [Itemid] => 
    [lang] => ru
    [input_text_0] => Name
    [input_text_1] => mail@mail.com
    [input_text_2] => 1234
    [input_datetime_11] => 2012-10-26
    [input_text_4] => Text
    [chrono_verification] => 6jz4q
    [input_submit_8] => Выслать
    [06b93e0a57028dca8da19a06e607fde1] => 1
    [language] => ru-RU
)

Validation Errors:

Array
(
)

Debug Data

    Core Captcha
        Passed the core captcha check!
    email
        2
            Result An email has been SENT successfully from (xxx.com| Заказы) xx.com to xxx
            Body
            Заказ рекламного объявления
            Имя/Фамилия: 	Name
            Э-почта: 	mail@mail.com
            Реквизиты: 	1234
            Названия газет: 	{input_custom_10}
            Дата публикации: 	2012-10-26
            Текст: 	Text


            Submitted by 78.158.19.69
            Attachments array ( )
        18
            Result An email has been SENT successfully from (xxx.com| Заказы) xxx.com to mail@mail.com
            Body
            Заказ рекламного объявления выслан!
            Имя/Фамилия: 	Name
            Э-почта: 	mail@mail.com
            Реквизиты: 	1234
            Газеты: 	{input_custom_10}
            Дата публикации: 	2012-10-26
            Текст: 	Text
            Attachments array ( )

 


So, as I see the {input_custom_10} is absent in array😟
GreyHead 14 Oct, 2012
Hi 01,

Yes, it looks as though your JavaScript is not removing the disabled attribute :-(

Bob
01 15 Oct, 2012
Also tried without "disabled='disabled'" - no luck.
But if I copy generated HTML output to blank php file and debug form - everything works...
GreyHead 15 Oct, 2012
Hi 01,

Sorry, there isn't enough information here to give me any clues about what is happening.

Please post a link to the form so I can take a quick look.

Bob
01 15 Oct, 2012
No problem, here it is:
http://xxx
As I looked through the FireBug - the custom element doesn't participate in POST at all😟 No data is sent
01 15 Oct, 2012
Thank you for your patient replies! It is if custom JS. It somehow overrides values. Will debug.
Have a great day!
This topic is locked and no more replies can be posted.