Forum OpenACS Q&A: assign variables from javascript to openacs

I'm very new here and I'm also very new to OpenACS.
I'm working with ]project open[ and I'm missing a popup calender.

I implemented a popup calender written in JavaScript but I need to assign the variables. Unfortunately I have no idea how this could work.

Here a small piece of my code:
set html "(here I call the Javascript function calendar() )"

template::element::create $form_id start \
-datatype "date" widget "date" \
-label "[_ intranet-core.Start_Date]"
-after_html $html

I hope that somebody could help me.


Posted by Saskia J. on
In addition to that I searched around the forum and found some postings about a popup calendar:

But where can I find that widget?

Posted by Ryan Gallimore on
Hi Sasika,

You can attach the OpenACS showCalendar function to a button and ask it to populate a textbox.

I'll use the recommended ad_form Tcl procedure to build the form:

ad_form -name calendar -form {
{value " ... "}
{html {onClick "return showCalendar('start_date', 'ymd');"}}

For the showCalendar JS code, see /packages/acs-subsite/www/resources/core.js

For more info on ad_form, see this guide.

Posted by Saskia J. on
Thanks a lot Ryan Gallimore, this works great!

But this calendar returns a date in american format, I would like to use european format.

I took a look in the source code of core.js and I only found the function showCalendar(id). I haven't found a possibility to change the date format.
Maybe someone has an idea?

Posted by Dave Bauer on
You'll need to modify that function to make it work with different date formats.