Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
57 posts Page 6 of 6
Previous 1, 2, 3, 4, 5, 6 Next
Hey all!

I couldn't find a solution in this topic for this problem and i think this could be helpful for more people :):

I'm using a form that's been build with the data-bound-form addon and it works perfectly. However, when submitting the form, i would like to show the date in dd-mm-yyyy. I understand that in Couch the date is internally by default stored as yyyy-mm-dd.

Is there a way to change the way the date is showed in the email when submitting a form? If possible only in the result/mail without having to change the form. I've been searching in the php files for a solution but couldn't find a way to change te format so far.
Hi,

You may use the <cms:date> tag to output a date in whatever format you desire.
Please see http://www.couchcms.com/docs/tags-reference/date.html

Hope this helps.
@KK

Thanks for your help! However, this not the solution to my problem.

The problem is that my input date is in the correct date format (dd-mm-yyyy) but when submitting, couch automatically formats it to its yyyy-dd-mm.

So when submitting the form i would like to have the format in the e-mail i receive, to be in dd-mm-yyyy. Is there any way to achieve that?

i've added some screenshots for clarification ;)

Thanks!

Attachments

@paulpg, I haven't had a chance to take a look at your code but I suspect it is somewhat akin to the following which uses <cms:show k_success /> in the email -
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
    The following is an email sent by a visitor to your site:
    <cms:show k_success />
</cms:send_mail>

The 'k_success' variable consolidates the values of all the inputs in the form to give a single string and is thus easier to use.
However, if need be, one can alternatively show the value of each input individually also.

For example, suppose you have two inputs in your form named 'my_text' and 'my_date', following would be the exact equivalent of the code above (please notice the use of 'frm_' prepended to the input names) -
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
    The following is an email sent by a visitor to your site:
    my_text: <cms:show frm_my_text />
    my_date: <cms:show frm_my_date />
</cms:send_mail>

With each input's value available separately, we can now process them further e.g. change the format of the submitted date as follows
Code: Select all
<cms:send_mail from=k_email_from to=k_email_to subject='Feedback from your site'>
    The following is an email sent by a visitor to your site:
    my_text: <cms:show frm_my_text />
    my_date: <cms:date frm_my_date format='d-m-Y' />
</cms:send_mail>

Does this help?
KK wrote: Does this help?

Yes, absolutely. ;) This is exactly what i was looking for. Thank you!
I'm still relatively green in working with PHP and JS...I'm trying to implement the calendar popup date picker, and think I realize that the method posted which uses MooTools won't work with current versions of Couch...I understand that it somehow has to be converted to use JQuery...can someone help me out in what needs to be done in order to enable such a feature? I currently have a datetime field on the admin site, which is an expiration date for posts, and instead of a generic month/day/year input fields, the client wants a popup calendar to pick the expiration date.

Any help would be much appreciated!!
wysocki wrote: I was on v1.x but I just switched over to v2. That done, it was easy to just implement the datepicker in the Jquery UI. Thanks!


Could you share how you went about implementing the datepicker calendar via Jquery?
Previous 1, 2, 3, 4, 5, 6 Next
57 posts Page 6 of 6

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 3 guests

cron