You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by james_sg <sn...@hotmail.com> on 2010/01/20 07:59:41 UTC

DateField not working in IE 7

Hi,

I found recently that the datefield popup stop working in Internet Explorer
7. 
No such problem with firefox. 

Any possible workaround?

Regards,
James
-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4425087.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by james_sg <sn...@hotmail.com>.
The problem is solved by the above code. Thanks.
-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4454181.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Hi James,

I've checked in a possible fix for this issue. Would you be able to test this in your environment 
and let me know if this works for you?

Basically there is now a check in IE for the "onreadystatechange" event and the default "onload" 
event is handled differently.

You can grab the latest copy of control.js here:

http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/META-INF/resources/click/control.js?view=co&revision=903848&content-type=text%2Fplain

You'll also notice the following check:

   if ( !document.body ) {
     // If body is null run this function after timeout
     return setTimeout(arguments.callee, 13);
   }

But I don't think that is really necessary and it seems dangerous as it could introduce an infinite 
loop if the <body> element is not specified in the markup. If you remove the !document.body check, 
does your code still work?

Also did you specify a default <body onload"..."> event in your iframe?

kind regards

bob


On 26/01/2010 02:03 PM, Bob Schellink wrote:
> Thanks James, I didn't think it could be possible for document.body to
> be null. Your patch have made me look at JQuery's implementation and
> they also have a check for 'if (!document.body)' so we should roll this
> in. They also have specific code for supporting iframes through the
> 'onreadystatechange' event which seems interesting.
>
> More info can be read here:
> http://www.subprint.com/blog/demystifying-the-dom-ready-event-method/
>
> And of course JQuery source code, especially the bindReady and ready
> functions:
> http://code.jquery.com/jquery-1.4.js
>
> kind regards
>
> bob
>
>
> On 26/01/2010 01:24 AM, james_sg wrote:
>>
>>
>> if (window == top) {
>> var d = window.document;
>> (function () {
>> try {
>> d.documentElement.doScroll('left');
>> } catch (e) {
>> setTimeout(arguments.callee, 50);
>> return;
>> }
>> // Dom is ready, run events
>> Click.domready.run();
>> })();
>> } else {
>> var d = document;
>> (function () {
>> if (d.body==null) {
>> setTimeout(arguments.callee, 50);
>> return;
>> }
>> // Dom is ready, run events
>> Click.domready.run();
>> })();
>> }
>>
>
>


Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Thanks James, I didn't think it could be possible for document.body to be null. Your patch have made 
me look at JQuery's implementation and they also have a check for 'if (!document.body)' so we should 
roll this in. They also have specific code for supporting iframes through the 'onreadystatechange' 
event which seems interesting.

More info can be read here:
   http://www.subprint.com/blog/demystifying-the-dom-ready-event-method/

And of course JQuery source code, especially the bindReady and ready functions:
http://code.jquery.com/jquery-1.4.js

kind regards

bob


On 26/01/2010 01:24 AM, james_sg wrote:
>
>
> if (window == top) {
>    var d = window.document;
>    (function () {
>      try {
>        d.documentElement.doScroll('left');
>      } catch (e) {
>        setTimeout(arguments.callee, 50);
>        return;
>      }
>      // Dom is ready, run events
>      Click.domready.run();
>    })();
> } else {
>    var d = document;
>    (function () {
>      if (d.body==null) {
>        setTimeout(arguments.callee, 50);
>        return;
>      }
>      // Dom is ready, run events
>      Click.domready.run();
>    })();
> }
>


Re: DateField not working in IE 7

Posted by james_sg <sn...@hotmail.com>.

if (window == top) {
  var d = window.document;
  (function () {
    try {
      d.documentElement.doScroll('left');
    } catch (e) {
      setTimeout(arguments.callee, 50);
      return;
    }
    // Dom is ready, run events
    Click.domready.run();
  })();
} else {
  var d = document;
  (function () {
    if (d.body==null) {
      setTimeout(arguments.callee, 50);
      return;
    } 
    // Dom is ready, run events
    Click.domready.run();
  })();
}

-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4454155.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Interesting about the iframe. If you look at control.js you'll see the addLoadEvent function (which 
is probably the most complex function in the world!) has a check for IE:

// Guard against iframe
if (window == top) {

Perhaps that will fix the issue? There is also links to websites of folks who have assembled this 
function. So I'm not sure if the iframe hack might break something else?

Its also worth looking at popular JavaScript libs such as JQuery on how they resolve this issue.

Let us know your findings.

kind regards

bob

On 22/01/2010 08:29 PM, james_sg wrote:
>
> Hi Bob,
>
> I done some checks and found that the problem happens when the Click page is
> inside the iFrame.
> Event.Observe doesn't seems to work very well with addLoadEvent inside
> iFrame.
> I'll see if I can solve the problem over the weekends.
>
> Thanks and regards,
> James


Re: DateField not working in IE 7

Posted by james_sg <sn...@hotmail.com>.
Hi Bob,

I done some checks and found that the problem happens when the Click page is
inside the iFrame.
Event.Observe doesn't seems to work very well with addLoadEvent inside
iFrame.
I'll see if I can solve the problem over the weekends.

Thanks and regards,
James
-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4439075.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Do you have some code that reproduce this? I tested with the example extra-controls-form.htm by 
adding two DateFields and don't see any issue. Both calendars popup as expected.

kind regards

bob

On 22/01/2010 07:41 PM, james_sg wrote:
>
> Hi Bob,
>
> I am working with the trunk version. The problem seems to lie with the
> prototype's observe function.
> IE 8 is also affected. Attached is where the undefined error occurs in the
> prototype script.
>
> Regards,
> James
>
> http://n2.nabble.com/file/n4438931/bug.gif
>
>


Re: DateField not working in IE 7

Posted by james_sg <sn...@hotmail.com>.
Hi Bob,

I am working with the trunk version. The problem seems to lie with the
prototype's observe function.
IE 8 is also affected. Attached is where the undefined error occurs in the
prototype script.

Regards,
James 

http://n2.nabble.com/file/n4438931/bug.gif 


-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4438931.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Hi James,

Are you testing with trunk? It seems to be working for me with the current trunk.

kind regards

bob

On 22/01/2010 04:50 PM, james_sg wrote:
>
> Hi Bob,
>
> Only the 1st Datefield in a form can pop up correctly. So the problem arises
> when there is more than one DateField in the form.
>
> The second addLoadEvent statement and onwards, isn't working in my IE 7.
>
> Regards,
> James
>
>


Re: DateField not working in IE 7

Posted by james_sg <sn...@hotmail.com>.
Hi Bob,

Only the 1st Datefield in a form can pop up correctly. So the problem arises
when there is more than one DateField in the form.

The second addLoadEvent statement and onwards, isn't working in my IE 7.

Regards,
James


-- 
View this message in context: http://n2.nabble.com/DateField-not-working-in-IE-7-tp4425087p4438487.html
Sent from the click-development mailing list archive at Nabble.com.

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Can I get another shot at this?

Turns out the real culprit was a bug in PageImports that was fixed for 2.1.0 final. The bug allowed 
for duplicate html imports to be specified. In the case of the date field, the Prototype library was 
specified twice in HTML:

<script src="/click-examples/click/prototype/prototype_2.1.0-RC1.js"></script>
...
<script src="/click-examples/click/prototype/prototype_2.1.0-RC1.js"></script>

The easiest fix for now is to checkout and build Click from trunk as described here:

http://incubator.apache.org/click/docs/developer-guide/source-code.html
http://incubator.apache.org/click/docs/developer-guide/building.html

Sorry for all the noise.

kind regards

bob


On 20/01/2010 07:40 PM, Bob Schellink wrote:
> Scratch my previous response.
>
> I did some testing and the reason this issue is not showing up in trunk
> is because the examples are running in standards mode. In previous
> versions it was running in quirks mode.
>
> So the simplest solution is to add the following doctype to your border
> template:
>
> <!doctype html>


Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
On 20/01/2010 07:40 PM, Bob Schellink wrote:

> Unfortunately Calendar Date Select is not maintained anymore


RightJS is a new JS library making ground. It has a nice calendar popup which supports date and time:

http://rightjs.org/ui/calendar/demo

Its released under MIT, so compatible with Apache.

kind regards

bob

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Scratch my previous response.

I did some testing and the reason this issue is not showing up in trunk is because the examples are 
running in standards mode. In previous versions it was running in quirks mode.

So the simplest solution is to add the following doctype to your border template:

   <!doctype html>

The doctype above is understood by all major browsers, even IE6. Alternatively use click-calendar 
found here[1].

We'll have to try and fix the calendar to run in quirks mode though. Unfortunately Calendar Date 
Select is not maintained anymore so we'll have to fix this ourselves.

kind regards

bob

[1]: http://code.google.com/p/click-calendar/


On 20/01/2010 05:59 PM, james_sg wrote:
>
> Hi,
>
> I found recently that the datefield popup stop working in Internet Explorer
> 7.
> No such problem with firefox.
>
> Any possible workaround?
>
> Regards,
> James


Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
On 20/01/2010 06:56 PM, Bob Schellink wrote:
>
> c:\path-to-your-app\webapp\click\prototype.js


Made a mistake. The path should be:

c:\path-to-your-app\webapp\click\prototype\prototype.js

bob

Re: DateField not working in IE 7

Posted by Bob Schellink <sa...@gmail.com>.
Hi James,

I assume this is with Click 2.1.0-RC1? I can confirm this has been fixed in trunk, but I'm not 100% 
sure what the fix was. My guess is that RC1 used Prototype 1.8.1-RC2. Meanwhile Prototype 1.8.1 has 
been released, which is the version we have in trunk. Perhaps you can try out version 1.8.1 of 
Prototype? To override Click's version of prototype, simply include the new prototype.js in your web 
application under the 'click' folder:

   c:\path-to-your-app\webapp\click\prototype.js

Click won't override existing resources with its own version.

Let me know if this works for you.

kind regards

bob

On 20/01/2010 05:59 PM, james_sg wrote:
>
> Hi,
>
> I found recently that the datefield popup stop working in Internet Explorer
> 7.
> No such problem with firefox.
>
> Any possible workaround?
>
> Regards,
> James