This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Time Validation


  1. tmparisi
    Member

    In version 3 is there a way to set a validation on the time? For example, if the user enters a value less than 4:00pm, an error will be displayed.

    Also, can the 'AM' field be taken out of the dropdown?

    Posted 12 years ago #
  2. tmparisi
    Member

    I am assuming both of these would need to be done in the actual PHP...?

    Posted 12 years ago #
  3. tmparisi
    Member

    Anyone have a thought?

    Posted 12 years ago #
  4. tmparisi
    Member

    This is what was added to the post-functions.php file right above line 1367 ($form_unique_ip = $row['form_unique_ip'];).... thanks to MachForm it now works perfect:

    if ($form_id == 2) {
    //time validation
    $time_element_id = 4;

    if (!empty($table_data['element_' . $time_element_id])) {
    $time_extract = array();
    $time_extract = explode(":",$table_data['element_' . $time_element_id]);

    if ($time_extract[0] < '16') {
    $error_elements[$time_element_id] = 'Time only allowed more than 4PM';
    }
    }
    }

    Posted 12 years ago #

RSS feed for this topic

Reply