Custom Validators

Home Forums Quform WordPress Custom Validators

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15734
    mtupuschies
    Participant

    Hi,

    again me with an issue on the time Element. Is there a way to set the time field up so 00:00 can’t be selected? Since I use this to track time spent on tasks, rather than an hour in a day, 00:00 should not be selected.

    Thanks in advance,

    M

    #15757
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #15765
    mtupuschies
    Participant

    As usual! Great support…

    Really sorry but there one thing I just realised when I checked the submissions.

    I have a form which writes all the data in a database. One field also writes the date using the given variable yyyy-mm-dd

    No I just realised that when someone at the East coast of the US fills in the form after 4pm their time the date submitted comes in with a day too early. For example some users submitted their form on 30/06/2015 at 5pm (us time) – in the database the date selected is already the 01/07/2015.

    Is there any way I can have the date populated to the database but taking the local date of the user rather than the server location? i’d like to avoid to add a manual date selector, just for convenience.

    Would be great if you have a tip.

    #15767
    mtupuschies
    Participant

    Found this in the tips. And added a hidden date selector… see how this goes.

    function mytheme_date_today()
    {
    $now = current_time('timestamp');

    return array(
    'day' => date('j', $now),
    'month' => date('n', $now),
    'year' => date('Y', $now)
    );
    }
    add_filter('iphorm_element_value_today', 'mytheme_date_today');

    #15768
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #15776
    mtupuschies
    Participant

    Brilliant!
    Had to change:
    $('.iphorm_1_1').val((new Date()).yyyymmdd());
    to:
    $('input[name=iphorm_1_1]').val((new Date()).yyyymmdd());

    but now its working like charm. Couldn’t have done without your help!

    Thanks again.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy