Problems with calendar.js and IE

290 views
Skip to first unread message

Mike

unread,
Jul 20, 2008, 11:10:47 AM7/20/08
to web2py Web Framework
Hi Everyone,

Just getting started with web2py (and so far I love it!) so I hope I
didn't miss anything too obvious.

I am testing a SQLFORM with 'date' and 'datetime' fields and the popup
calendar works fine on Firefox, but not on IE 6 or IE 7. The
ui.datepicker example on link from AlterEgo works fine on IE though. I
even downloaded the souce from Dynarch and their examples worked on
IE. So I'm stumped.

Has anyone run into this?

Thanks,

Mike

Mike

unread,
Jul 22, 2008, 7:55:23 PM7/22/08
to web2py Web Framework
I got it working...

The javascript error was "unexpected identifier". Turns out there was
an extra comma in the following code from web2py_ajax.html.


try {$("input.date").focus( function() {Calendar.setup({
inputField: this.id,
ifFormat: "{{=T('%Y-%m-%d')}}",
showsTime: false, //<--EXTRA COMMA
}); }); } catch(e) {};
try { $("input.datetime").focus( function() {Calendar.setup({
inputField: this.id,
ifFormat: "{{=T('%Y-%m-%d %H:%M:%S')}}",
showsTime: true,
timeFormat: "24", //<--EXTRA COMMA
}); }); } catch(e) {}

Credit goes to push in the right direction from these folks
http://www.ventanazul.com/webzine/articles/javascript-expected-identifier-error-internet-explorer

Kyle Smith

unread,
Jul 23, 2008, 2:36:36 AM7/23/08
to web...@googlegroups.com
Hi Mike,

Sorry I didn't respond directly to the group as I caught these a few hours ago. It only took a couple of seconds to track down, but I couldn't actually look at it until I finished up some work today.

There is indeed an extra comma at the end of the two identifiers for date and datetime and anyone that is currently using the posted version can correct the problems by removing those two commas in web2py_ajax.html. I've already contacted Massimo to make the updates as well as provided an update to the calendar.js file to integrate the time picker that Tito posted about today.

Kyle

Kyle Smith

unread,
Jul 23, 2008, 2:39:20 AM7/23/08
to web...@googlegroups.com
Oh, just one further follow up. If you are using IE regularly you may want to turn on script error warnings as the error description pointed directly to the line and character where the error was occurring which would have pointed to the two extra commas. While js debugging is pretty horrible in IE unless you have the Script Editor that is part of Microsoft Office or Visual Studio, little things like that can be caught with the basic error reporting built into IE.

Kyle

Mike

unread,
Jul 23, 2008, 8:15:52 AM7/23/08
to web2py Web Framework
Kyle, thanks for the tips and the updated files!

Mike

On Jul 23, 2:39 am, "Kyle Smith" <kyletsm...@gmail.com> wrote:
> Oh, just one further follow up. If you are using IE regularly you may want
> to turn on script error warnings as the error description pointed directly
> to the line and character where the error was occurring which would have
> pointed to the two extra commas. While js debugging is pretty horrible in IE
> unless you have the Script Editor that is part of Microsoft Office or Visual
> Studio, little things like that can be caught with the basic error reporting
> built into IE.
>
> Kyle
>
>
>
> On Tue, Jul 22, 2008 at 11:36 PM, Kyle Smith <kyletsm...@gmail.com> wrote:
> > Hi Mike,
>
> > Sorry I didn't respond directly to the group as I caught these a few hours
> > ago. It only took a couple of seconds to track down, but I couldn't actually
> > look at it until I finished up some work today.
>
> > There is indeed an extra comma at the end of the two identifiers for date
> > and datetime and anyone that is currently using the posted version can
> > correct the problems by removing those two commas in web2py_ajax.html. I've
> > already contacted Massimo to make the updates as well as provided an update
> > to the calendar.js file to integrate the time picker that Tito posted about
> > today.
>
> > Kyle
>
> > On Tue, Jul 22, 2008 at 4:55 PM, Mike <michael.mcgreg...@gmail.com> wrote:
>
> >> I got it working...
>
> >> The javascript error was "unexpected identifier". Turns out there was
> >> an extra comma in the following code from web2py_ajax.html.
>
> >> try {$("input.date").focus( function() {Calendar.setup({
> >>     inputField: this.id,
> >>     ifFormat: "{{=T('%Y-%m-%d')}}",
> >>     showsTime: false, //<--EXTRA COMMA
> >> }); }); } catch(e) {};
> >> try { $("input.datetime").focus( function() {Calendar.setup({
> >>     inputField: this.id,
> >>     ifFormat: "{{=T('%Y-%m-%d %H:%M:%S')}}",
> >>     showsTime: true,
> >>     timeFormat: "24", //<--EXTRA COMMA
> >> }); }); } catch(e) {}
>
> >> Credit goes to push in the right direction from these folks
>
> >>http://www.ventanazul.com/webzine/articles/javascript-expected-identi...
>
> >> On Jul 20, 11:10 am, Mike <michael.mcgreg...@gmail.com> wrote:
> >> > Hi Everyone,
>
> >> > Just getting started with web2py (and so far I love it!) so I hope I
> >> > didn't miss anything too obvious.
>
> >> > I am testing a SQLFORM with 'date' and 'datetime' fields and the popup
> >> > calendar works fine on Firefox, but not on IE 6 or IE 7. The
> >> > ui.datepicker example on link from AlterEgo works fine on IE though. I
> >> > even downloaded the souce from Dynarch and their examples worked on
> >> > IE. So I'm stumped.
>
> >> > Has anyone run into this?
>
> >> > Thanks,
>
> >> > Mike- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages