Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello fellow CouchCMS-Users.
Since I haven't found anything after an 10 minute internet search: Is there a possibility to use javascript in Templates?

As example to display the current date/time in a field.

Thank you for your awnsers!

- Helagon
Hi,

On the frontend - Couch remains agnostic of what you put in your templates (i.e. you are free to use whatever JS you wish).
On the backend - there are several ways to 'inject' custom JS in the admin-panel.

Could you please explain in detail exactly what you are planning to do? That'd help in framing a more helpful answer.

Thanks.
Hi KK!

I have this event calendar for an event which usually takes place every saturday. In this template I insert some specific information of the event such as where we meet or what do we have to take with us for this event.

I would like to automatically change the date for the date field to the next saturday, but still be able to change it manually to some other date. Next to that I have a field where I can set the date when an email will be send, which I want to set to the current date.

I've tried doing this with setting the default value of the editable, but that stays static.

I can do the JS/JQuery part, I just need to know how Couch actually allows js functions in the admin panel.

Thanks in Advance!

- Helagon
I just need to know how Couch actually allows js functions in the admin panel.

Ok. Please take a look at the following post and you'll find several ways of customizing your admin-panel -
viewtopic.php?f=5&t=10241#p24680

The easiest for your use-case, I think, would be the use of <cms:script> block within <cms:config_form_view> e.g. as follows -
Code: Select all
<cms:config_form_view>
    <cms:script>
        $( function(){
            ..
        });
    </cms:script>
</cms:config_form_view>

Hope this helps.
Thank you!
That helped!
5 posts Page 1 of 1
cron