Forums

show thanks message

Guusta 01 Jan, 2014
I have a form with a show thanks message.

Beste {Roepnaam} {Tussenvoegsel} {Achternaam},

What i want is only show {Tussenvoegsel} when there is input in that field.
How can i do that with something like if else?

Joomla 3.2 Chronoforms V4
GreyHead 01 Jan, 2014
Hi Guusta,

Add a Custom Code action before the Thanks Page action with code like this in it:
<?php
$name_array = array(
  'Roepnaam',
  'Tussenvoegsel',
  'Achternaam'
);
$name = array();
foreach ( $name_array as $n ) {
  if ( isset($form->data[$n]) && $form->data[$n] ) {
    $name[] = $form->data[$n];
  }
}
$form->data['name'] = implode ' ', $name;
?>
Then use {name} in the Thank You Page action.

Bob
Guusta 01 Jan, 2014
Yes this hethod works. however there is a little problem

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/XXXXXXX/domains/XXXXXXXXX.nl/public_html/administrator/components/com_chronoforms/form_actions/custom_code/custom_code.php(19) : eval()'d code on line 13
Data Array:
Array
(
[option] => com_chronoforms
[chronoform] => Tussen
[event] => submit
[Roepnaam] => Guusta
[Tussenvoegsel] =>
[Achternaam] => Theewen
[input_submit_4] => Submit
[cf60176e9ed0b7fd2f23a528410c7068] => 1
)

Validation Errors:
Array
(
)

Beste Guusta Theewen
GreyHead 01 Jan, 2014
Hi Guusta,

oops . . . some missing brackets :-(
$form->data['name'] = implode(' ', $name);


Bob

My excuse is that I had an early start this morning . . .
Guusta 01 Jan, 2014
Yes, it works, Thank you
This topic is locked and no more replies can be posted.