Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

datepicker and onselect

Go to End



Community Member, 1 Post

1 June 2012 at 3:25pm


I am using Silverstripe 2.4.3 and jquery for form validation, following the example here:

I have all the JS files specified in my and have added the following to my page:
function init() {

jQuery(document).ready(function() {
rules: {
Paper: "required",
NumberOfCopies: "required",
DateRequiredProduction: {
required : true,
date : true
messages: {
Paper: "Please pick a paper type",
NumberOfCopies: "My default is a million copies",
DateRequiredProduction: "Let me know the date so I can exceed your expectations"



Now form validation is working great so far with the exception of a DateField, if you enter a valid entry to start off then everything just works. If you do not enter a value in the field and trigger a validation error on submit. You need to select a date twice in order for the field to get validated.

I believe is can be fixed by defining a callback in the onselect method and have it call my validate method?

However I have tried several things to get that to work and so far none have been successful. I tried adding the following to the JS above:
jQuery("#DateRequiredProduction").datepicker("option", "onSelect", function() {
alert("this is test");

But I just get:
jQuery("#DateRequiredProduction").datepicker is not a function

Any ideas?