Skip Navigation

[Resolved] How can I set the default time value of a date-time field in cred Form?

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by claas-hendrikS 4 years, 8 months ago.

Assisted by: Minesh.

Author
Posts
#1606725
Time Value.jpg

Hallo Toolset team,

how can I set the default time value of a date-time field in cred Form? The preselected time is 08:00 but I need 23:59.

I can't find a field to change this default value. Is there a snippet to change it?

Thank you for your support and
best regards
Claas

#1606957

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

To change the default value of the custom date/time field added with your Toolset form, you need to add the custom JS code.

You should try to add the following code to your form's JS box:

jQuery( document ).ready(function($) {
    
 $('select[name="wpcf-your-field[hour]"]').val(23);
 $('select[name="wpcf-your-field[minute]"]').val(59);
   
});
 

Where:
- You need to adjust your custom date field slug with wpcf-your-field

#1607231

My issue is resolved now. Thank you!