Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Date field - only show future dates. Possible? 18 Oct 2017 07:47 #15397

  • dyvel
  • dyvel's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 200
  • Thank you received: 11
Hi

Would it be possible to show (and validate) the date field, to show and allow only future dates in the field?

Please Log in or Create an account to join the conversation.

Date field - only show future dates. Possible? 19 Oct 2017 18:02 #15400

  • dyvel
  • dyvel's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 200
  • Thank you received: 11
Looked at Joomla Calander documentation ( docs.joomla.org/Calendar_form_field_type ) - no future date option there. I've created a custom rule under models called futuredate, that will test the date and return false if date is in the past, but this is server side validation, and is only called on submission. If validation fails, user has to go back and fill out/submit the form again. Not the best user experience.

Please Log in or Create an account to join the conversation.

Last edit: by dyvel.

Date field - only show future dates. Possible? 24 Oct 2017 10:22 #15420

You can validate a future date like this:

- copy the xml file of the form to your fork/model/forms/table.xml
- remove all fields except the one you want to validate
- add class="validate[future[now]]" to the parameters
- fork the form.php (table_form.php or so)
- add code outside the php tags:
<script>
jQuery.validationEngineLanguage.allRules.future = {
    "alertText" : '<span class="msg-prefix">• </span>Select a date after '
};
</script>

Something like that should work
The following user(s) said Thank You: dyvel

Please Log in or Create an account to join the conversation.

Last edit: by Romkabouter.

Date field - only show future dates. Possible? 31 Oct 2017 15:38 #15424

  • dyvel
  • dyvel's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 200
  • Thank you received: 11
Not sure why I didn't get an email with your post, but thank you! It works.
Really appreciate all your help :-)

Thanks!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.053 seconds

First let me congratulate you on an excellent/outstanding product. Just tried for one hour but was very impressed.
Marret (Forum)

Get Started