chandrajavin / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

embed inside perl cgi not working #264

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following call is not working inside a perl cgi code

<!-- page specific scripts -->
<script type="text/javascript" charset="utf-8">
jQuery( function()
    {
        jQuery('date-picker').datePicker().val(new Date().asString()).trigger('change');
    }
);
</script>

Any suggestion? Thanks.

Peter

Original issue reported on code.google.com by pemhu...@gmail.com on 22 Feb 2011 at 8:13

GoogleCodeExporter commented 8 years ago
Here is the simplified perl script which doesn't work.

Thanks!

Peter

Original comment by pemhu...@gmail.com on 22 Feb 2011 at 10:30

Attachments:

GoogleCodeExporter commented 8 years ago
I don't know much about perl but it doesn't seem like your problem is related 
to the date picker. Some questions after a quick look:

 * Are all of the javascript files in the correct place relative to your script? Do you see any 404 errors in the Firebug network panel when you load the page?
 * Why do you set the header to image/svg+xml? Surely it should be text/html?
 * You aren't outputting a DOCTYPE so your page will render in unreliable quirks mode.

With the snippet you have pasted above there are two ways you could achieve 
this which would be easier:

 1) Echo the date into the input's "value" attribute directly from perl - the date picker will take the value from the input when you initialise it.
 2) Something like this:

jQuery('date-picker').datePicker().dpSetSelectedDate((new Date()).asString());

Hope it helps,

Kelvin :)

Original comment by kelvin.l...@gmail.com on 23 Feb 2011 at 9:04

GoogleCodeExporter commented 8 years ago
Hi Kelvin,

Thanks for the kind email reply. You are right. The reason this failed is 
because of image/svg+xml as when I changed it to text/html, it worked!

However, the reason for using image/svg+xml is because I embed several SVG 
files inside my website plus some MySQL and other stuff. Therefore, the header 
has to be 'image/svg+xml'.

Therefore, I am not sure why it doesn't work for 'image/svg+xml'. Could your 
team take a look at this? Thank you very much!

Best,

Peter

Original comment by pemhu...@gmail.com on 24 Feb 2011 at 9:59

GoogleCodeExporter commented 8 years ago
But you aren't serving up an image. You are serving up an HTML page which 
happens to contain some SVG data... The content type should still be text/html

You could try referencing the svg namespace in your HTML tag if you are putting 
the SVG inline:

<html xmlns:svg="http://www.w3.org/2000/svg">

Although I don't think that will work cross browser - I think you'll need to 
load the SVG as seperate documents (using embed or iframe or maybe even image 
tags) - those documents should have the image/svg+xml namespace...

Either way, it's not really related to the date picker...

Original comment by kelvin.l...@gmail.com on 25 Feb 2011 at 9:25

GoogleCodeExporter commented 8 years ago
Hi Kelvin,

Thanks for the kind email.

The code I sent to you is simplified. The original code is more than 5000 
lines. I think as long as it illustrates the core problem, there is no need to 
add un-relative part in.

Still, it might come up again in other cases especially cross browsers...

Thanks.

Peter

Original comment by pemhu...@gmail.com on 25 Feb 2011 at 1:21

GoogleCodeExporter commented 8 years ago
Hi there,

This is to follow up with my question regarding date picker module.

When I use firefox 4.0, the date picker is fine.

However, when I moved to IE9, I could only see the calendar icon, and when I 
click it, nothing happens as if there is no event fired.

I use the following: 
<!--[if IE]><script type="text/javascript" 
src="javascript/jquery.bgiframe.min.js"></script><![endif]-->
in my script.

Any suggestions?

Thank you very much!

Kind,

Peter

Original comment by pemhu...@gmail.com on 2 Mar 2011 at 9:49

GoogleCodeExporter commented 8 years ago
Hi there,

I don't know how when I removed the line
<!--[if IE]><script type="text/javascript" 
src="javascript/jquery.bgiframe.min.js"></script><![endif]-->

The date picker is fine. But why?

Thanks.

Peter

Original comment by pemhu...@gmail.com on 2 Mar 2011 at 10:55