Formidable Forms

The Most Advanced WordPress Forms Plugin and Form Builder

  • Features
  • Pricing
  • Blog
  • Support
  • Login
  • Get Formidable Forms

frm_date_field_options

Last Updated: January 28, 2019

Knowledge Base → Extend Formidable Forms → Formidable Hooks - for Developers → Field Appearance → frm_date_field_options
Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Alter the datepicker options before they are converted to javascript.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

Usage

add_filter( 'frm_date_field_options', 'my_custom_function', 20, 2 );

Parameters

  • $date_options (array)
  • $args (array)
    • $args['field_id'] (string) - The HTML id for this field
    • $args['options'] (array) - The settings for this field

Examples

Blackout dynamic dates

This example will Blackout the New Years day when the Datepicker Options plugin is used.

add_filter( 'frm_date_field_options', 'add_blackout_dates', 30, 2 );
function add_blackout_dates( $js_options, $extra ) {
	if ( $extra['field_id'] === 'field_jtumj' ) { // Replace jtumj with your field key
		$js_options['formidable_dates']['datesDisabled'][] = date( 'Y-m-d', strtotime( 'first day of january' ) );
	}

	return $js_options;
}

Hide month and year selectors

datepicker-inline-format By default, the month and year are displayed in dropdown lists. By using this code, it will allow you to show the month and year in the calendar display header and have users select dates by using the next/previous buttons.

add_filter( 'frm_date_field_options', 'hide_month_and_year', 30, 2 );
function hide_month_and_year( $js_options, $extra ) {
	if ( $extra['field_id'] === 'field_jtumj' ) { // Replace jtumj with your field key
		$js_options['options']['changeMonth'] = false;
		$js_options['options']['changeYear'] = false;
	}

	return $js_options;
}

Add calendar icon to field

This example adds a clickable calendar icon next to a date field. When the icon is clicked, it will pull up the calendar. It is recommended to move the icon image to your site's images folder and adjust the path in the code. You can change the icon to any image in your site's images folder.

add_filter( 'frm_date_field_options', 'add_cal_icon', 30, 2 );
function add_cal_icon( $js_options, $extra ) {
	if ( $extra['field_id'] === 'field_jtumj' ) { // Replace jtumj with your field key
		$js_options['options']['showOn'] = 'button';
		$js_options['options']['buttonImage'] = 'http://jqueryui.com/resources/demos/datepicker/images/calendar.gif';
		$js_options['options']['buttonImageOnly'] = true;
	}

	return $js_options;
}
  • Usage
  • Parameters
  • Examples
    • Blackout dynamic dates
    • Hide month and year selectors
    • Add calendar icon to field
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms
Install Formidable Lite

Using WordPress and want to get Formidable Forms for free?

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact

Top Features

  • Front End Editor
  • Repeating Fields
  • Views from Entries
  • Calculator Forms
  • Conditional Logic
  • Visual Form Styler
  • Form Templates
  • User Submitted Posts
  • File Upload Forms
  • Spam Protection
  • Multi Page Forms
  • Surveys & Polls
  • Form Graphs & Charts
  • Save and Continue
  • Mobile Forms
  • Stripe Forms
  • PayPal Forms
  • WooCommerce Forms
  • MailChimp Forms
  • User Registration
  • Signature Forms
  • Bootstrap Forms
  • Quiz Maker
  • Zapier Forms
  • Salesforce Forms
  • HubSpot Forms
  • API Webhooks
  • Multilingual Forms
  • Directories

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • Blog

Copyright © 2021 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews