by
KK » Tue Sep 16, 2014 3:42 pm
Hi Steve,
I see that you are getting confused by the way forms are processed by Couch.
If you take a look the docs at
http://www.couchcms.com/docs/concepts/forms.html, you'll find that whenever a Couch managed form is submitted, Couch flags the success condition by setting the 'k_success' variable which contains the submitted values of all fields concatenated together in a single string.
Additionally, it also makes available the submitted values of each field dicretely as variables that have 'frm_' prepended to the field names. e.g. if 'email' and 'name' are two fields, their values are available as 'frm_email' and 'frm_name'.
This gives us a choice to either use the single k_success variable or cherrypick each individual fields.
You have been using k_success so far.
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
<cms:show k_success />
</cms:send_mail>
If you make the code as follows, you can use individual values to craft the kind of message you want -
<cms:send_mail from=k_email_from to=k_email_to subject='Comment posted'>
The following comment has been posted at your site:
Name: <cms:show frm_k_author />
Email: <cms:show frm_k_email />
Comment: <cms:show frm_k_comment />
</cms:send_mail>
Point to note in the code above is that the names of the fields always used in the comment form are 'k_author', 'k_email', 'k_comment' and so these can be accessed (by prepending 'frm_' to the names) as 'frm_k_author', 'frm_k_email', 'frm_k_comment'.
Hope this helps.