I have a custom view helper in app/view/helper folder. The code for add text field is - in my code: $this->view->formText('date'); But instead of text field i want to add jquery datepicker like this: $this->view->datePicker('date');
But this does not work. Please help. Regards
In principle, you do not need a view helper for this.
On the client side, just attach the jQuery datapicker to your element. How you target that element with a client-side selector is dependent upon the DOM hooks you have available in your page/form, but as an example, assuming a form with id
myForm
and an input field with namemyDate
that you would like to function as a datepicker, you could simply use:Of course, this presumes that jQuery is loaded when this runs and that the datepicker plugin is loaded by the time the ready event fires on the document object.