• 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: Create capacity limitation for each Item in dropdo

Create capacity limitation for each Item in dropdo 10 years 9 months ago #28364

  • kareez
  • kareez's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 14
Hi
I created a form and use this php code for create limitation registration form.
$max = 1;
$user = JFactory::getUser();
$db   = JFactory::getDbo();
$query   = $db->getQuery(true);
$query->select('COUNT('.$db->qn('Username').')')
    ->from($db->qn('#__rsform_submissions'))
    ->where($db->qn('FormId').'='.$db->q($formId))
    ->where($db->qn('Username').'='.$db->q($user->get('username')));
$db->setQuery($query);
$counter = $db->loadResult();
if ($counter >= $max){
  $formLayout = '<p style="color:red;">Sorry, you have reached the maximum number of submissions for this form.</p>';
}
 
global $database;
$database = JFactory::getDBO();
$database->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE `formId`='25'");
$database->query();
if (intval($database->loadResult()) >= 33)
{
echo 'Dear user, Limitation of this group is full. Please try other Groups.';
$formLayout = '';
}
It work very exact.
But I have a dropdown list in this form. This php code just control limitation for all Item of dropdown list.
I need limitation for each item self-governing in one form.
Example:
Group1 - 33 limitations.
Group2 - 23 limitations.
Group3 - 13 limitations.

Capacity of item 1 is 33 user.
Capacity of item 2 is 23 user.
Capacity of item 3 is 13 user.

Each user just can fill this form for one time.

Like below image:



How can I do it?
Last Edit: 10 years 9 months ago by kareez.
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!