PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Conditional Logic for Appointment Scheduling

  1. kyle
    Member

    I'm setting up an appointment request form for an auto dealership. It works fine but I need some additional functionality. I've read this, which has some similar elements:

    http://www.gravityhelp.com/forums/topic/email-based-on-day

    Right now, the user picks the day they'd like for their appointment (using the date field), and then the time they wish to have their appointment (currently this is an hour field but I think I'll switch to a dropdown for the problem I have). The problem is that they are not limited to their time selection based on the hours of the service department. Here is what I need:

    1. When the user chooses a date from the date picker, (I'll need to block certain dates (holidays and Sundays from appearing here - with jQuery or PHP I suppose, see item 2) I'd like to have some conditional logic that adjusts the hours in the dropdown field based on the day of the week (Monday, Tues, Thursday and Saturday are open 8am 6pm - Friday and Wednesday they're open from 10am to 9pm). The dropdown would be populated with 15 minuted increments between those hours (8:00, 8:15, 8:30, 8:45, 9:00... 5:30, 5:45, 6:00).

    What's the best way of doing this? I know about the conditional logic in Gravity Forms, but it doesn't seem that you can create conditional logic based on a date. Should I be doing this with a php hook, or using Javascript? On their old, non Gravity Forms field I used javascript.

    2. Also, is it possible to block dates in the datepicker on the PHP end, or can I only do this with jQuery? I'd like to set it up so only a certain number of appointments can be booked for each date. Ideally this would query the submitted form entries for the information.

    Side note - it'd be great to be able to use more criteria for the conditional logic (and notification routing).

    Posted 13 years ago on Tuesday April 19, 2011 | Permalink
  2. Not sure that Gravity Form's conditional logic will be granular enough to easily support the specificity of the conditions you have. Not that it isn't possible, but this is a situation where you'd probably be better off doing the conditional logic as a javascript customization.

    In addition to customizing the javascript for the conditional logic make sure to make sure of Gravity Form's gform_validation hook to verify that the dates selected are valid on the server side.

    Posted 13 years ago on Tuesday April 19, 2011 | Permalink
  3. kyle
    Member

    Okay, thanks. So do I need to do anything special with gravity forms in order to set the jQuery to update the contents of the Hour dropdown, or can I just do things as I would regularly?

    Posted 13 years ago on Wednesday April 20, 2011 | Permalink
  4. You should be able to target and use jQuery to manipulate the drop down just like you would normally do.

    Posted 13 years ago on Wednesday April 20, 2011 | Permalink