Date validation on Submit

cmwincom 18 Mar, 2014
I am wondering if it is possible to compare the date a form is submitted to a set deadline date. The idea is that when a visitor clicks submit it compares the date of submission to the deadline date.

For example I have a form for a scholarship application. The deadline for the submission is April 11th. I would like it that when the visitor clicks submit if the date is April 12th or later a message pops up informing them that the online submission deadline has passed. Or another option would be to hide the submit button after April 11th and display a message instead.

Is this possible. If so, how would I do it?
GreyHead 19 Mar, 2014
Hi cmwincom,

For CFv4 you can use my Watchman [GH] action that lets you set 'publish' and 'unpublish' dates for a form.

Bob

PS The action should be OK on Joomla! 2.5 but might need updating for Joomla! 3. Please let me know if you have any problems.
cmwincom 19 Mar, 2014
Hello GreyHead,

I have installed your custom action. The question now is where do I use it? Do I put it in the On Load or the On Submit section under events?
GreyHead 19 Mar, 2014
Hi cmwincom,

At the beginning of the form On Load event is the usual place.

Bob
cmwincom 19 Mar, 2014
GreyHead,

That is what I thought and what I did. I've set the open date as 2014-03-21 and the close date as 2014-04-21. However, when I browse to the page with the form, the form displays. Any suggestions?
GreyHead 26 Mar, 2014
Hi cmwincom,

Do you have an Event Loop action in the pink On Fail event of the Watchman action?

Bob
cmwincom 27 Mar, 2014
No I don't. How should I do that.

I've attached a screen capture of my on load section.

[attachment=0]chrono.png[/attachment]
GreyHead 27 Mar, 2014
Hi cmwincom,

Just drag an Event Loop action into the pink Denied action (I'd forgotten it was denied and not On Fail).

That will re-load the form on failure. Instead of the Event Loop you could use a ReDirect; or a Custom Code plus a Show Stopper to show a message.

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