• 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: User can use the form only 5 times a day - Script?

User can use the form only 5 times a day - Script? 16 years 11 months ago #3705

Have anybody an idea to make a restriction of 5 times a day access to the form. That means he can only send 5 times a day the form.
And on the next day he can send 5 times again.
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3706

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
Solution is easy, but you have to do it yourself for this time, i hace to work on my site :

For Pro Version :
on your manage form :
Insert a hide field
Into is defaut value, with code make a count request with date and userid
on script display add a script script display :
search your pre filled field with getbyelemntid
if value > what you want => redirect to a page of your choise
script
Component RS SHow Form in build
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3708

Thank you for your quick answer, I will try it!
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3720

getbyelemntid=DateSubmitted
getbyelemntid=Username
getbyelemntid=auftraege (the counter)

How I can realize that this user can send only X forms for this day?
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3722

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
You have wrong

First you have create your hide field : nice

Second you have to pre filled them into defaut value with
<code>
$user = $RSadapter->user();
jimport('joomla.utilities.date');
$now = new JDate():
$db =& Jfactory::getDB0();
$db->setQuery(\"SELECT * FROM #__rsform_submissions WHERE DateSubmitted = '$now' AND UserId = '$user['id']'\"«»);
$data = $db->loadObjectList();
$numer = count($data);
return $numer;
//</code>

Third you add into your script display a javascript or ajax code :
$formlayout .= insert your javascript code who use function getbyelementid search the only hide who give result of request and redirect if your value';
return $formlayout;
<br><br>Post edited by: dragonjc, at: 2008/07/15 13:41
Component RS SHow Form in build
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3741

Hello Dragonjc,

first, thank you for your reply, but I think it is a little bit difficult for me, because I have no idea about Java or Ajax, sorry.
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3742

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
I have an other idea, but i don't know if it fonctionned , you are my tester :woohoo:
//&lt;code&gt;
$user = $RSadapter-&gt;user();
jimport('joomla.utilities.date');
$now = new JDate():
$db =&amp; Jfactory::getDB0();
$db-&gt;setQuery(\&quot;SELECT * FROM #__rsform_submissions WHERE DateSubmitted = '$now' AND UserId = '$user['id']'\&quot;«»);
$data = $db-&gt;loadObjectList();
$numer = count($data);
if (count == 5) $This-&gt;setRedirect('index.php?option=' . JRequest::getCmd('option'));
return $numer;
//&lt;/code&gt;

It can fonctionned whithout java, but not sure, so try ... and you will see, but insert data with an account for test, or you will be redirect from manage because preview exe the code...

Give me some news.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3744

Report from your tester:

The good message is, no error - the bad message, it do not work!
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3746

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
Ok can you see in mysql database what's the value is for into the hide field ?
Just to know if the counter is write into ...

Another test : change the end please.
//&lt;code&gt;
$user = $RSadapter-&gt;user();
jimport('joomla.utilities.date');
$now = new JDate():
 
$db =&amp; Jfactory::getDB0();
$db-&gt;setQuery(\&quot;SELECT * FROM #__rsform_submissions WHERE DateSubmitted = '$now' AND UserId = '$user['id']'\&quot;«»);
$data = $db-&gt;loadObjectList();
 
$numer = count($data);
if (count &gt; 5) return $This-&gt;setRedirect('index.php?option=' . JRequest::getCmd('option'));
 else return $numer;
//&lt;/code&gt;
<br><br>Post edited by: dragonjc, at: 2008/07/17 06:54
Component RS SHow Form in build
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3753

Ok can you see in mysql database what's the value is for into the hide field ?
Just to know if the counter is write into ...

This will be the problem, there is no value für the hide field, there is no hide field!
The field called \"counter\" and in jos_RSFORM_SUBMISSION_VALUES is no field with this name!
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3763

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
ok that doesn't matter, try with a normal input field.
Past the code like say, and give me result.
If Ihave time i will try into my site.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:User can use the form only 5 times a day - Scri 16 years 11 months ago #3765

with a normal input field it is the same, no value in database
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!