Time default value now

This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.

This guide will show you how to set the default value of a Time element to be the current time.

Step 1

Go to the Time element settings, Optional tab and tick the option Dynamic default value and enter the Parameter name now

now

Step 2

Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
3
4
5
6
7
8
9
10
11
function my_time_now()
{
    $now = current_time('timestamp');
 
    return array(
        'hour' => date('g', $now),
        'minute' => date('i', $now),
        'ampm' => date('a', $now)
    );
}
add_filter('iphorm_element_value_now', 'my_time_now');
function my_time_now()
{
    $now = current_time('timestamp');

    return array(
        'hour' => date('g', $now),
        'minute' => date('i', $now),
        'ampm' => date('a', $now)
    );
}
add_filter('iphorm_element_value_now', 'my_time_now');
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy