• 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 the number of submissions per form

Limit the number of submissions per form 15 years 3 months ago #6438

Is there a script we can add so that after a number of submissions have been made, the form doesn't show anymore or it doesn't take any more submissions?

now that would be a great complementation to rsform.

Thank you in advance for any suggestions!

rsform enthusiast:woohoo:
The administrator has disabled public write access.

Re:Limit the number of submissions per form 14 years 7 months ago #8583

Bump...

I would be very interested in this too. Probably pretty simple.

Simon
The administrator has disabled public write access.

Re:Limit the number of submissions per form 14 years 7 months ago #8585

  • matt
  • matt's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 136
  • Thank you received: 14
Hi!

I recived this script from the RSJoomla team and it works great to limit submissions.

Copy and paste the code below to the scrpits tab:

Script called on form display
/*THIS SCRIPT LIMITS SUBMISSIONS TO 10*/
$submissions = @mysql_result(mysql_query("SELECT COUNT(`SubmissionId`) FROM ".$RSadapter->tbl_rsform_submissions." WHERE `formId`='".$formId."'"),0);
if (intval($submissions) >= 10)
{
	//the formLayout variable contains all the form output. let's overwrite it
	$formLayout = '<font color="red">Sorry, no more submissions are accepted !</font>';
}
 
/*LET'S DISPLAY THE NUMBER OF CURRENT SUBMISSIONS*/
/*YOU CAN DELETE THIS LINE, IF YOU DON'T NEED IT*/
$formLayout .= 'Current number of submissions: '.mysql_result(mysql_query("SELECT COUNT(`SubmissionId`) FROM ".$RSadapter->tbl_rsform_submissions." WHERE `formId`='".$formId."'"),0);   
$formLayout .= ' (10)';

Script called on form process
$submissions = @mysql_result(mysql_query("SELECT COUNT(`SubmissionId`) FROM ".$RSadapter->tbl_rsform_submissions." WHERE `formId`='".$formId."'"),0);
if (intval($submissions) >= 10)
{
	//If you are showing the form inside an article, replace the link below with the article link
	$redirectLink = 'index.php?option=com_rsform&formId='.$formId;
	$RSadapter->redirect($redirectLink,'Sorry, no more submissions are accepted !');
}

Matt
Last Edit: 14 years 7 months ago by matt.
The administrator has disabled public write access.
The following user(s) said Thank You: nikita.gupta, info5870

Re:Limit the number of submissions per form 14 years 7 months ago #8621

Thanks... I'll try that out.

Simon
The administrator has disabled public write access.

Re:Limit the number of submissions per form 14 years 7 months ago #8623

Works great... Any idea how I could change it from showing the number of submissions made to the number of submissions left?

I know what I need to do - take away the number of submissions made from the number of submissions allowed - but no idea how to do this!

TIA
Simon
The administrator has disabled public write access.

Re: Limit the number of submissions per form 12 years 2 months ago #16718

Does this limit work on the individual users?

how do we limit it to the users? for example, all users be allowed to submit the form 2 times each.
The administrator has disabled public write access.

Re: Limit the number of submissions per form 5 years 1 month ago #39040

2019 version, if anyone needs it :)
$sql = "SELECT COUNT(*) FROM #__rsform_submissions WHERE `formId`='".$formId."'";
$db->setQuery($sql); 
if ($db->loadResult() >= 10)
{
	$formLayout = '<font color="red">Sorry, no more submissions are accepted !</font>';
}
The administrator has disabled public write access.
The following user(s) said Thank You: eero, dietze6
  • 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!