I can't think of a way to do this with conditional logic. You could modify the form after it's displayed, using a little jQuery (the jQuery would say, essentially, "if the current time is between 1600 and 2400, then hide this specific form field".) The hiding could be done via CSS (display:none, using a custom class for that field.)
Or, you could have two different forms: one for 0000 to 1600, and one from 1600 to 2400. Then you can have logic in your page template or post/page to display one form or the other. That would mean there are entries in two different places. Maybe that's OK because you might want to handle them differently, different notifications?
Maybe you could use the gform_field_css_class http://www.gravityhelp.com/documentation/page/Gform_field_css_class in a function to add a CSS class of "hidden" or "afterhours", based on the current time. It would be the same approach as with jQuery, but done in PHP in your theme's functions.php. So, if the time of day is between 1600 and 2400, then add the CSS class of "afterhours" and your theme's stylesheet would already have the style like this to hide that field:
[css]
.afterhours {
display:none;
}
You could get more specific with the selector but that was just a quick example.
Do any of those ideas help?
Posted 12 years ago on Friday July 20, 2012 |
Permalink