Help with validating dates and the datepicker pieces/parts

michelemjordan 06 Oct, 2011
I've tried really hard to figure out how to use the datepicker field in the General tab of the form, the individual datetime elements, and the custom datepicker actions in the form. I've read every post here that i could find that had to do with validating dates. If I put anything in the General tab of the form or the extra options extensions field of custom datepicker, I don't get a calendar anymore. And it doesn't use the info I put in either.

My form:
http://mmjconsulting.com/secludedvalleyrvcampground/index.php/reservations.html

I have the arrival date element set with a Field Class of arrival_date, and a custom datepicker action that is in On Load, before the Show HTML box, with the same Field Class of arrival_date, and the extra options extensions shows:

minDate: {date: '05-01-2012', format: 'm-d-Y'}, maxDate: {date: '10-15-2012', format: 'm-d-Y'}


Campground is only open May 1 to Oct 15, so why let them pick anything else?


Right now the Departure Date field has no customization. Ultimately I want to set the maxDate on it, and make sure it's after the Arrival Date.

when I go to the form, I don't get a calendar on the Arrival Date, but I do on Departure Date. If I click Submit, it doesn't complain about the Arrival Date being before the minimum either.

Can I get a step-by-step of how I'm supposed to do this? Everything I've read seems to suffer from the "Clear Only If Known" problem, meaning the person describing it knows it so well, the instructions seem very clear. It took me a bit just to find the General tab for the form! I can't find half the fields that people are talking about, and I know that the code structure has changed so I'm never sure if what I'm looking at is correct or not. I get the part that the arrival_date:: part isn't needed anymore, and I think my extra option extension part has the correct syntax. Why don't I get a calendar? Why will it let me pick any date anyway?

I'm a very intelligent person! How can one little thing make me feel so inadequate? Help!

-Michele

Joomla 1.7.1
Chronoform v4 RC 2.0
dezi168 07 Oct, 2011
Hi Michele,
I opened a thread few days ago about minDate on datePicker inputs.
I think everything you did is right. But you may suffer a javascript bug (that would explain why the datepicker is not displayed).
Can you please check the javascript console if there not a javascript error ? Something like :
Uncaught TypeError: Cannot call method 'toString' of undefined, datepicker.js:670

Hope this will help you.
michelemjordan 07 Oct, 2011
When I load the page with Firebug turned on, I get several errors in mootools-core.js and mootools-more.js.


Then in en.js from com_chronoforms/js/formcheck/lang and I get the error:
assignment to undeclared variable formcheckLanguage
on line 28.

That line is
select_multiple : "Please choose at least one value"

None of the other items defined in en.js have a ' ' between the name and :, so I suspect that is a problem.


Some errors in jquery.js and lightbox.js from the YooTheme WidgetKit


In the html file itself I get
assignment to undeclared variable formCheck


When I click in the arrival date field, it is set to today, and I receive an error in datepicker.js:
reference to undefined property this.options.minDate.date
Line 92

and another:
t is undefined
Line 670

If I look at the Firebug Console Errors, it complains only about the t is undefined on Line 670.

I receive the t is undefined Line 670 error whether I click in the Arrival Date or Departure Date field.

Hope this helps.

-Michele
michelemjordan 07 Oct, 2011
One more point, I can't type in the arrival date or departure date fields on my form. Since I get no datepicker with the arrival date, it is always today. I can pick a departure date.

Is this how the date fields are supposed to work? You have to choose using the calendar?

-Michele
dezi168 08 Oct, 2011
Hi Michele,
I spent few minutes to check your page.
I confirm that you have exactly the same problem I described in my post.
I seriously think this is a bug in the datepicker javascript (with minDate and maxDate options).

You mention that the datepicker is displayed only for departure date (and not arrival date). This can be explained by the fact that departure date is not using minDate or maxDate options (then you don't fall in the bug and it works) and arrival date is using minDate option (then you fall in the bug, then the datepicker is not displayed).

While waiting for Max to find a solution, the workaround is to avoid using javascript minDate and maxDate options and to create an action "custom server side validation" to check that dates that are posted.

I also proposed in my post a solution that fixed the bug (in my testings).
michelemjordan 08 Oct, 2011
Thanks so much for your concern and help dezi. I just purchased a subscription for this website, and have been just a bit disappointed with the support.

I appreciate you taking the time to share with and help guide me, validate what I was trying to do was the appropriate way and places to do it. Your original posts help get me to where I thought I had it correct. I'll try the suggestion you made. (I hope you documented your workaround in the original post.)

Do you have an idea of the bug fix cycle, how long it will be before we could expect a fix? I don't yet have a feel for the product release cycle for this company.

I still feel that datepicker is complicated enough that it needs a good tutorial written for it, explaining clearly the choices and locations of all the options. It is in bits and pieces, and sometimes not clear for a newbie, although I know the author felt it was very clear because he knew exactly what he was talking about.

Thanks!

-Michele
GreyHead 09 Oct, 2011
Hi michele,

I agree with you that better documentation for the date-picker would be useful. If you feel inclined to write it please do; it's on my long list of things to do one day. But as I'm pretty much a volunteer here it probably won't get done this weekend.

Have you actually read the datepicker script documentation? You can see that here. That's probably also the place to report bugs in the datepicker.js script.

Bob
michelemjordan 10 Oct, 2011
Hey Bob,

I understand the volunteer/long list of things to do. And I'll be honest, I skimmed the datepicker documentation in mootools, but if I wanted to learn it in that detail I wouldn't have chosen an extension for the forms, or purchased a subscription. And the datepicker documentation from mootools doesn't really explain how it integrates into Chronoforms, and where and when to set the pieces and parts for the whole form, a certain field, etc. I see that there are places to add the variables, and I did use that documentation and the forum posts to determine where to put things, and that I was providing the variables for Min/Max date correctly. It was very kind of dezi to work with me to confirm that I'm hitting a bug, and not a problem in my configuration. But, I don't know enough to write a tutorial about it, as seems to be apparent since I can't make it work.

Do you know the bug/fix cycle? I need to let my customer know that what we want to do is a bug in the software they just paid for the subscription for, and how long until they can expect that bug to be fixed. I worked a bit with Chronoforms in the free version before recommending it to them and recommending they purchase the subscription to make the links go away, and now I have to tell them it doesn't actually do exactly what we need it to do, although I thought it could, and I would also like to tell them when they can expect the functionality to work.

Fortunately it is a summer RV campground, and they're about to close for the season and head to Florida, and not return until April to prepare for opening. But they'll start getting reservation requests over the winter as people plan their summers, it is a popular RV park here and is usually booked full the majority of the time, so people schedule early.

I'm going to change the forms so people can choose any dates, and just put in the header text a reminder that the first date available is May 1 and the last date available is Oct 15, but the form should really be doing this for them, and I told my customer it could based on what I saw and read. I'm sure the issues can be replicated in development, since two of us now have found the problem. Developers (is this Max?), if for some reason you need me to set it in my form again to see the issues, please let me know. Otherwise, I need to make sure the form at least works until we get to actually validate the dates within the form.

Thanks for all the help dezi, and if there is something I need to do to help re-create the problem we're experiencing, please let me know.

-Michele
GreyHead 10 Oct, 2011
Hi Michele & dezi,

I have written a post here which gets ChronoForms to work with a later version of the DatePicker that does not have the same problems with MooTools 1.3.

I haven't tried all the bells and whistles yet but minDate and maxDate are working with fixed dates and I think that they can be used fairly easily with variable dates.

If you try it please do not use on a live site without testing and let me know about any problems you find.

I can't speak for Max but hopefully this or something very similar will find it's way into a forthcoming update of ChronoForms for Joomla! 1.6/1.7

Bob
This topic is locked and no more replies can be posted.