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
Appnitro Software Forums » MachForm
Date control / validation
(7 posts)-
Posted 1 year ago #
-
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 # -
hi, is the solution applicable to old versions?
Thanks
Posted 1 year ago # -
may I know which version do you use ?
Posted 1 year ago # -
Hi redityo, its for a friend, says its VERSION 2.0.g.
Thanks
Posted 1 year ago # -
Yes, It should working fine with that version
Posted 1 year ago # -
ok sir, thanks :-)
Posted 1 year ago #
Reply
You must log in to post.