Forums

White fields Emai template

osnysantos 13 Apr, 2010
When someone sent a form, with any white field.
The email template comes like:

Name: Jack
Email: [email]jack@kack.com[/email]
Age: {age}

How to convert all white fields at "space"?
for example:

Name: 'Jack'
Email: [email]'jack@kack.com[/email]'
Age: ' '

Thanks
GreyHead 16 Apr, 2010
Hi osnysantos,

In the OnSubmit Before Email box you need to set a value so that ChronoForms finds it when it does the search and replace in the template html.
<?php
$age = JRequest::getVar('age', '', 'post');
JRequest::setVar('age', $age);
?>

Bob
osnysantos 20 Apr, 2010
But i have more than 20 fields, What do I do?
GreyHead 20 Apr, 2010
Hi osnysantos,

Try this
<?php
$input_array = array('input_1', 'input_2', . . . ) ;
$posted = JRequest::get();
foreach ( $input_array as $v ) {
  if ( !in_array($v, $posted) {
    JRequest::setVar($v, '');
  }
}
?>
it should be fine for text values, may need to be tweaked to work with arrays.

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