Support » Plugin: Date Picker in List Fields for Gravity Forms » Default date per field

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author ovann86

    (@ovann86)

    Hey Jonas,

    You’re right, there’s not a way to do a default date per field – but I would like to make it possible.

    I’ve been thinking about how to do this …

    For the standard date fields in Gravity Forms you can set a default value each field, as well as use a filter to do advanced rules like 5 days in the future. So I think that’s a good goal to reproduce.

    I’ll see if I can make this happen in the next few days and will report back.

    Thanks for the feedback. That would be awesome!

    Plugin Author ovann86

    (@ovann86)

    Hey,

    I’ve just released version 1.7.0 that has an option for setting the default date for each column.

    I’ve set it up so it can be done through PHP as well, if you want to do something a little more clever – such as ‘monday this week’.

    I’ll put a few examples in the FAQs page in a few days time, but basic usage example (you need to know the form ID, field ID and column number. Also make sure the date is in the same format as the field.)

    add_filter( 'itsg_datepicker_fields', function ( $datepicker_fields, $form_id ) {
    if ( '2' == $form_id ) {
    	$datepicker_fields['22'] = array( '1' => date( 'm/d/Y', strtotime( 'friday this week' ) ) );
    	return $datepicker_fields;
    }
    }, 10, 2);

    Thanks a lot!

    Unfortunately there is one bug: When the list is hidden and only shown conditionally the pop-up calender is shown at the bottom of the page.

    Are you able to reproduce the issue?

    Plugin Author ovann86

    (@ovann86)

    Hey,

    I wasnt able to reproduce the issue but I knew this plugin was creating the date picker icon different, compared to the standard date field.

    Can you try version 1.7.1 and see if you still see the issue?

    If you do, which browser/s do you see this happen in?

    Do you have the latest version of Gravity Forms installed?

    Plugin Author ovann86

    (@ovann86)

    Hi again.

    For some reason the datepicker in the footer bug decided to happen when I was testing another plugin.

    You should find the isue resolved in version 1.7.2.

    Thanks again for reporting it.

    Hi

    Thanks a lot for fixing the bug! It works now as expected.

    Jonas

    somethumb

    (@somethumb)

    I’m unable to get this to work. My form is at http://www.ablecloset.com/agreement-borrow-equipment-release-liability/

    And this is the code I’m using in functions.php:

    // Add default date to list field datepicker
    add_filter( ‘itsg_datepicker_fields’, function ( $datepicker_fields, $form_id ) {
    if ( ‘6’ == $form_id ) {
    $datepicker_fields[‘2’] = array( ‘3’ => date( ‘m/d/Y’, strtotime( ‘now’ ) ) );
    }
    return $datepicker_fields;
    }, 10, 2);

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Default date per field’ is closed to new replies.