Page 1 of 1

Formbuilder: exclude select menu items after given date

Posted: Wed Nov 13, 2013 4:05 pm
by Jonny
I have a form set up for visitors to enquire about events occurring during the current year.

The events are selected from a dropdown select menu, populated by a ***Field.class.php file that I've added.

It works fine, but I'm wondering if there is a way for events to only be included in the select menu if the current date is before a given date.

Is this something that could be done in Formbuilder's Advanced Settings for the field using Smarty or PHP conditionals?

Re: Formbuilder: exclude select menu items after given date

Posted: Thu Nov 14, 2013 1:08 pm
by Jonny
Oh well. Given my PHP skills, it'll have to be done with javascript :)

Re: Formbuilder: exclude select menu items after given date

Posted: Thu Nov 14, 2013 7:26 pm
by calguy1000
if you wrote the field for formbuilder to popuplate the list it'd probably be simpler to modify the list at that time to exclude events in the past.

Re: Formbuilder: exclude select menu items after given date

Posted: Thu Nov 14, 2013 8:21 pm
by Jonny
Thanks for your reply, Calguy.

The form has previously been updated annually: replacing the previous years events with those for the upcoming. Listing expired events may be confusing for end users, so the requirement is to remove them as they expire, without manual editing of the list.

The form was a last minute addition a couple of years back, and the site will probably be switched to more sophisticated events management in future. I have the javascript ready to roll and it'll improve the site for the majority of visitors, but a server-side solution would obviously have been preferable.