Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Is it possible to create a user editable subject line for contact forms? I think it will help me sift through the mail and quickly figure out what is spam or simply figure out what message belongs to who. Thanks!
Yes, of course.

Suppose following is the opening tag of send_mail
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>

Instead of hard-coding the subject as above, we can use any variable for it. For example
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject=my_subject>

or
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject="<cms:show my_subject />">

The 'my_subject' could be an editable region that you define in the contact template for the site-owner to edit.

Does this help?
I actually meant front end user, not the site owner using the backend.
I think KK gave you the answer for a front end user to fill a field for your mail.

Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject="<cms:show frm_my_subject />">


In your form/page create a field ...
Code: Select all
<cms:input name='my_subject ' label='Your subject' type='text' required='1' />


This would be your editable subject.
I load frameworks and write bugs on top of them, after that I rearrange the code so that it looks like a cool product.
@cardmaverick, as @Tomarnst said, the principle remains the same - the point is that you are free to use a variable instead of the hard-coded string.

In the example above, if your contact form has an input named 'my_subject', the value submitted through it would be available as a variable named 'frm_my_subject' and that is what we use as the subject.
5 posts Page 1 of 1