Appending HTML Brackets to Form

TreeFish 27 Feb, 2017
What I'm intending to do is:
Copy a specific html bracket into a chronoforms field and send it via E-Mail.

My Current Approach is:
Have a <div class="chronoform-container" id="hiddenmsg"></div> -> hidden from form view
A JS that pastes contents into the container jQuery('#hiddenmsg').append(msg_cnt); on load (working)
Send it all via Mail. {hiddenmsg} -> The e-mail gets there but doesn't show that specific field.

This approach works if it's used with text/textarea fields but that does not allow for html brackets.
The field reference (including its wrappers) is also present in the mail - however, it's always empty.

Any help/direction pointing towards this requirement is welcome.

(Why this approach you'll ask: different pages use the same template for dynamic content - I'd like to use just one form that grabs the required information and adds it to the mail. Just one form to make it easy to recycle. Wrappers are always the same so from my point of view a valuable option - unless of course, I'm missing something...)
Max_admin 27 Feb, 2017
Hi Treefish,

{field_name} will work only for input fields, you can't reference an element id, you will need to have your HTML inside a hidden textarea maybe and reference its name instead.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 27 Feb, 2017
Hi Treefish,

I'd probably put the HTML into an array in a file that I can include then you just need to identify the page and load the corresponding text from the array after the form submits. That gets round any problem with JavaScript loads and hidden inputs.

Include this file
<?php
$text = array();
$text['aaa'] = "<p>Some HTML here</p>";
. . .
$text['zzz'] = "<p>Some quite different HTML here</p>";

$form->data['text'] = '';
if ( !empty($form->data['page_id']) ){
  $form->data['text'] = $text[$form->data['page_id']];
}
?>
Then add {text} to your email template.

Bob
TreeFish 27 Feb, 2017
Hi admin,

thanks for your prompt response.
Unfortunately textarea fields won't accept HTML tags. You can Add them, but they'll get stripped on send.

I've had the idea to use WYSIWYG editor instead - since it would allow HTML tags to be wrapped. But it's a tricky endeavour...
Max_admin 28 Feb, 2017
Hi TreeFish,

You can try Bob's suggestion OR if you want to use a textarea then you may use a "custom" element, textarea tags with your html code inside.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.