Appnitro Software Forums » MachForm

Date control / validation

(7 posts)
  • Started 1 year ago by u761877
  • Latest reply from freiheitskampfer

  1. I would like to control the date filed so that i can restrict which days the form user can chose, The reason is that the form will be used to organise collections, so I need to restrict the user from booking a collection on a Saturday and Sunday, Please advise

    Posted 1 year ago #
  2. Hi,

    You can modify "post-function.php" file for this, go to around line 692 for this code :

    $validation_result = validate_element($target_input,$rules);

    then put these code above that line

    if ($form_id == 12 && $element_id == 1) {
    	if (!empty($test_empty)) {
    		if (date("l",strtotime($target_input['element_date']) ) == 'Saturday' ||
    			date("l",strtotime($target_input['element_date']) ) == 'Sunday') {
    				$error_elements[$element_id] = "You are not allowed to register on Saturday or monday";
    			}
    	}
    }

    in there I assume your form id is 12 and date element id to be check is 1, don't forget to change those id with yours.
    That modification will restrict any input date on sunday or saturday.

    Posted 1 year ago #
  3. freiheitskampfer
    Member

    hi, is the solution applicable to old versions?

    Thanks

    Posted 1 year ago #
  4. may I know which version do you use ?

    Posted 1 year ago #
  5. freiheitskampfer
    Member

    Hi redityo, its for a friend, says its VERSION 2.0.g.

    Thanks

    Posted 1 year ago #
  6. Yes, It should working fine with that version

    Posted 1 year ago #
  7. freiheitskampfer
    Member

    ok sir, thanks :-)

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.