• 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: Counter problem

Counter problem 13 years 2 months ago #12989

  • goooo
  • goooo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi Folks,

i wanted to create a form where the submit button is disabled when a certain number of submissions is reached. The form is displayed within a content page (via {rsform 3}).

I already created a textbox with this default value so I get a counter within the form:
//<code>
$db=JFactory::getDBO();
$db->setQuery("SELECT COUNT(`SubmissionId`) cnt FROM #__rsform_submissions WHERE FormId=4");
$db->query();
$result=$db->loadResult();
$voll = "No more free tickets";
if (intval($result) >=3) {
return $voll; 
}
else return intval($result);
//</code>

Is it possible to get the Submit Button disabled when a certain number is reached?

Another option would be, that the complete form would disappear.
I tried some code I found here in the "scripts when form displayed" area....like this one:
global $database;
$database = JFactory::getDBO();
$database->setQuery("SELECT COUNT(`SubmissionId`) FROM jos_rsform_submissions WHERE `formId`='4'");
$database->query();
if (intval($database->loadResult()) >= 3)
{
     echo 'Sorry, no more submissions are accepted !';
     $formLayout = '';
} 

But then the "Sorry no more subscriptions accepted" Line appears above the content area and not in the space where the form used to be.

Anyone got a clue how to get one or the other version running?

Best regards
Flo
The administrator has disabled public write access.

Re:Counter problem 13 years 1 month ago #13158

  • andreic
  • andreic's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

An example on this topic can be found here:

www.joomla-form.com/form-examples/form-s...mit-form-submissions

You can download this form, restore it in your Joomla! installation and use the script from this example in order to achieve your described scenario.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
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!