• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Limit selection of a date in rsform

Limit selection of a date in rsform 11 years 11 months ago #23076

Is there a way to limit the selection of the date field to a certain number of submissions? For instance I only want 11 people to be able to select any day in the calendar in the calendar.
The administrator has disabled public write access.

Limit selection of a date in rsform 11 years 11 months ago #23115

  • adrianp
  • adrianp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 631
  • Thank you received: 146
Hello,

From my understanding you want to limit the maximum number of submissions based on a date in the calendar? If this is the case, you can try using the following script in the "Scripts called on form process" area:
if(empty($invalid)){
$db = &JFactory::getDBO();
 
$result = $_POST['form']['calendar_field_name'];
 
$db->setQuery("SELECT COUNT(`FieldValue`) FROM #__rsform_submission_values WHERE `FormId`='1' AND `FieldName`='calendar_field_name' AND `FieldValue`='".$result."'");
 
$count = $db->loadResult();
 
	if($count >= 11){
	$invalid[] = RSFormProHelper::getComponentId("calendar_field_name");
	}
 
}

For the script above to work properly you will have to replace:

calendar_field_name - with your calendar field exact name;

1 - with your actual form ID(found by going to backend > Components > RSForm!Pro > Manage Forms and locate the form ID in the last column on the right);

11 - with your desired number of time a date is allowed to be submitted;

More information on the PHP scripting areas within RSForm!Pro can be found here:

www.rsjoomla.com/support/documentation/v...602-php-scripts.html

PS: note that the above $invalid method will not work if your form uses Ajax validation.
This is not official customer support. To receive your support, submit a support ticket here.
The administrator has disabled public write access.
The following user(s) said Thank You: phonroth701

Limit selection of a date in rsform 11 years 11 months ago #23130

Thank you! I will try this and let you know how it works.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!