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.

Display Start and End Dates from 'Schedule Form'

  1. Is there a way to display the Start and End dates/times that are selected in 'Schedule Form' section (located on the Advanced tab of the Form Settings)?

    It would be nice to tell the user when the form will expire and/or is valid for.

    Thanks

    Posted 12 years ago on Sunday September 11, 2011 | Permalink
  2. You can use the gform_pre_render hook and access these $form object properties:

    [php]
        $form['scheduleStart']
        $form['scheduleStartHour']
        $form['scheduleStartMinute']
        $form['scheduleStartAmpm']
        $form['scheduleEnd']
        $form['scheduleEndHour']
        $form['scheduleEndMinute']
        $form['scheduleEndAmpm']
        $form['scheduleMessage']
    Posted 12 years ago on Tuesday September 13, 2011 | Permalink
  3. Hi Chris,
    Ok, I'm a little lost on this... This is my attempt, but I am getting errors:

    // Add Start/End Date/Time on Gravity Form
    add_filter("gform_pre_render", "we_display_formdates");
    
    function we_display_formdates($form){
    
        //only for form id 9
        if($form["id"] != 9)
           return $form;
    
        //Adding items to field id 8. Replace 8 with your actual field id. You can get the field id by looking at the input name in the markup.
        foreach($form["fields"] as &$field)
            if($field["id"] == 8){
                return $form['scheduleStart'];
            }
    
        return $form;
    }

    Can you help me tweak it to make it work? :)

    Posted 12 years ago on Tuesday September 13, 2011 | Permalink
  4. Can you post a link to your form and then explain what message you want, based on what dates, and where it should be displayed?

    Posted 12 years ago on Wednesday September 14, 2011 | Permalink
  5. This is something that I'd be interested in too. Did you ever get it working? If so, can you share the code?

    Posted 11 years ago on Monday October 8, 2012 | Permalink
  6. WedEndev is still active here so I will leave this open in case they did get it working and would like to post their resolution.

    @aechols, if you like, you can post your question here and let us know what you would like to do and we can help you. Thanks.

    Posted 11 years ago on Monday October 8, 2012 | Permalink
  7. It would be nice to make a page that shows active forms to the public. If I could grab the start and end dates/times, I could make a page that would show currently active forms with the title and due date/time.

    We've embedded the form into a single page with the form number, and uses GET to grab the number from the URL so we don't have to manually embed the form into a page every time. Most of our forms are applications, so if we could use that data to populate another page, we won't have to add/remove the links manually and then everything would be automated.

    Posted 11 years ago on Monday October 8, 2012 | Permalink
  8. You can make a page that shows active forms. Those start and end times though are for a single form. So, you would first have to return an array of all active forms, then loop through them, and extract the end times and display that as well. It can be done using built-in Gravity Forms functions.

    Posted 11 years ago on Monday October 8, 2012 | Permalink