• 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: Stop submitting after 10 submits

Stop submitting after 10 submits 9 years 10 months ago #31520

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
Hi

Wondering if it would be possible to stop a form from being submitted after 10 guests has submitted it?

I would like to use the form as a simple order form for a stand at a venue.
But there are only 10 stands, so when 10 persons has ordered their stand, the form should no longer be able to submit.

Possible?

Hope I made my wish clear :-)

Regards
Thomas
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31521

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Please try an approach as per the example below.
// Get a database connection.
$db = JFactory::getDbo();
 
// Setup the query.
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE `FormId`='".(int) $formId."'");
$submissions = $db->loadResult();
 
// Verify if the submission count is higher than >
if ($submissions > 10) {
	$formLayout = '<p>Sorry, no more submissions allowed.</p>';
 }
 
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31522

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
Will give that a try, thanks!

Where do I insert this script?
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31523

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
That particular script needs to be inserted in Scripts called on form display. You can find more information here:
http://www.rsjoomla.com/support/documentation/view-article/602-php-scripts.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
The following user(s) said Thank You: info1593

Stop submitting after 10 submits 9 years 10 months ago #31524

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
I tried to put in PHPScripts $formLayout but the page fails with no error:
cityhorsens.dk/index.php?option=com_rsform&formId=1
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31525

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
I inserted this:

// Get a database connection.
$db = JFactory::getDbo();

// Setup the query.
$db->setQuery("SELECT COUNT('SubmissionId') FROM #h1uo_rsform_submissions WHERE 'FormId'='".(int) $formId."'");
$submissions = $db->loadResult();

// Verify if the submission count is higher than >
if ($submissions > 4) {
$formLayout = '<p>Sorry, no more submissions allowed.</p>';
}
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31526

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Your error is here:
 
$db->setQuery("SELECT COUNT('SubmissionId') FROM #h1uo_rsform_submissions WHERE 'FormId'='".(int) $formId."'");
 
// change it to this:
 
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submissions WHERE `FormId`='".(int) $formId."'");
 
 
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 9 years 10 months ago by cosmin.cristea.
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31527

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
Thanks, changed that, but I still see the form:

cityhorsens.dk/index.php?option=com_rsform&formId=1

And there are 6 submissions
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31528

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
PS, please copy paste my query from here:

https://www.rsjoomla.com/forum/37-rsform-pro/25876-stop-submitting-after-10-submits.html#31521

you do not need to modify anything in the script except the limit.
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.
The following user(s) said Thank You: info1593

Stop submitting after 10 submits 9 years 10 months ago #31529

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
I must have missed something, it's working now...

Thank you so much!!!!
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31530

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
glad that you figured it out!
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31531

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
Any chance I can bother you some more?

I would like to show how many stands are left and then the form if any are left... :-)
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31532

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Should work
// Verify if the submission count is higher than >
if ($submissions > 4) {
	$formLayout = '<p>Sorry, no more submissions allowed.</p>';
} else {
	$howMany = 4 - $submissions;
	$formLayout = '<p>'.$howMany.' stands left</p>'.$formLayout;
}
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31554

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
You rock!!!

Thank you so much :-)
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31564

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Glad that I could help!
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Stop submitting after 10 submits 9 years 10 months ago #31656

  • info1593
  • info1593's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 15
This is just working great!

I would like a small change...
So now it should not stop after x times submit, but after the total sum of a field has reached, let say 100.
Possible?

I know to little of coding, sorry...

Also thinking that some check on submit checks whether there are enough stands left before submitting...
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!