Post by matt1982 » Tue Feb 08, 2011 5:34 pm

Ok I am trying to add a datepicker field to the categories page.

I have done all the model and controller fields and they work fine and dandy it saves and loads etc just fine.

I thought i would recreate the datepicker js field by copying it from the products page.

However nothing I do seems to get it to work.

Here is the field:

Code: Select all

<input type="text" name="event_date" value="2009-01-27" size="12" id="event_date" class="hasDatepicker"/>
And at the bottom of the page I copied this code into it and changed the variables slightly:

Code: Select all

<script type="text/javascript" src="view/javascript/jquery/ui/ui.datepicker.js"></script>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('#event_date').datepicker({dateFormat: 'yy-mm-dd'});
});
//--></script>
I get no error messages in Firebug or Opera. I tried adding just after the datepicker initializes the following alert:

Code: Select all

$('#event_date').click(function(){ alert("Here"); });
Which does show the alert when I click the field.

I also tried deleting some of the image dialog JS to see if it was conflicting somehow (I can't see how it would as it is used on the product page,but clutching at straws)

I am at a total loss. Anyone got any ideas before I start to pull my hair out?

New member

Posts

Joined
Tue Sep 02, 2008 10:52 pm

User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by matt1982 » Wed Feb 09, 2011 5:59 pm

I know driving me insane I ended up leaving it until last so that maybe when I wasn't as frustrated it would pop out at me as to why it didn't work.

New member

Posts

Joined
Tue Sep 02, 2008 10:52 pm

Post by fido-x » Thu Feb 10, 2011 1:37 pm

JNeuhoff wrote:Very strange, can't see anything wrong with your code.
Neither can I.

Maybe you could try calling it by its "class", rather than by its "id", like so:

Code: Select all

$(document).ready(function() {
   $('.hasDatepicker').datepicker({dateFormat: 'yy-mm-dd'});
}); 
and see if that works.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by jadeye » Sat Jun 15, 2013 8:07 pm

Hello matt1982,

Any luck resolving the problem??

I am trying to use datePicker myself and I cant seem to get it going....
Neither as id nor as class="hasDatepicker".

Anyone has a solution??

Thank you.

Imagehttp://nwg.co.il/
“Compassion is the basis of morality.”
― Arthur Schopenhauer


New member

Posts

Joined
Sun Jul 15, 2012 12:35 am
Who is online

Users browsing this forum: No registered users and 4 guests