Nevermind! solved it, it's working now. 

I changed 

*array('id'=>'datepicker', 'type'=>'text')*

to

*array('class'=>'datepicker', 'type'=>'text')*


and then changed


<script>
$(function() {
       $("#datepicker").datepicker();
});
</script>

to 

*<script>*
*$(function() {*
*       $(".datepicker").datepicker();*
*});*
*</script>*


this way, jQuery uses the class, not the ID, to find the fields where 
datepicker must be applied.

Regards!

El martes, 29 de noviembre de 2011 22:11:27 UTC-2, Florin Trifu escribió:
>
> Thank you very much! Indeed it worked.
>
> Just to let the other users know in case they will have the same problem:
>
> 1. Download jquery (http://docs.jquery.com/Downloading_jQuery) and put 
> the file in $project/app/webroot/js (e.q: *
> $project/app/webroot/js/jquery.js*)
> 2. Download jquery-ui (http://jqueryui.com/download); I, for example, 
> downloaded a zip archive called: jquery-ui-1.8.16.custom.zip. From this 
> archive you will have to copy the followings:
>
> a. *$archive_root/js/jquery-ui-*.js* in *$project/app/webroot/js* (give 
> it a shorter name e.q: jquery-ui.js)
> b. *$archive_root/css/smothness/** to *$project/app/webroot/css*(including 
> the images; rename the css file to something shorter)
>
> 3. Include both js files in your layout. eq:
> *
> //$project/app/views/Layouts/default.ctp
> -------------------------------------------------------------
> echo $this->Html->script(array('jquery',
>                                         'jquery-ui'));
>
> *4. Include the css file. Eq
>
> *//$project/app/views/Layouts/default.ctp
> -------------------------------------------------------------
> echo $this->Html->css('jquery-ui.css');
>
> *5. Put this lines of code before calling the date-picker:
>
> *<script>
> $(function() {
>        $("#datepicker").datepicker();
> });
> </script>*
>
> 6. Call the date picker in your form:
>
> *echo $this->Form->input('expire', 
>         array(
>            'id'=>'datepicker',
>            'type'=>'text'
>         )*
>
> This is it!
>
> Best regards!
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.


Reply via email to