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

Hello!
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:
[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.

Greetings

Collapse
Posted by Saskia J. on
In addition to that I searched around the forum and found some postings about a popup calendar:
https://openacs.org/forums/message-view?message_id=242525

But where can I find that widget?

Collapse
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 {
{start_date:text(text)}
{popup_cal:text(button)
{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.

Collapse
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?

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