Page 1 of 1

Date Picker on Insert Categories

Posted: Tue Feb 08, 2011 5:34 pm
by matt1982
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?

Re: Date Picker on Insert Categories

Posted: Wed Feb 09, 2011 7:27 am
by JNeuhoff
Very strange, can't see anything wrong with your code.

Re: Date Picker on Insert Categories

Posted: Wed Feb 09, 2011 5:59 pm
by matt1982
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.

Re: Date Picker on Insert Categories

Posted: Thu Feb 10, 2011 1:37 pm
by fido-x
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.

Re: Date Picker on Insert Categories

Posted: Sat Jun 15, 2013 8:07 pm
by jadeye
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.