Prevent user from submitting the same form within 24 hours

SR89

New Member
Hi Community!

I'm new to fabrik and so far very excited about the flexibility of the component. I want to create a suvey-like Form which the users should fill out every 24 hours. But not earlier. Is there some kind of Element I can do that with? Ideal would be something like a notification to the user if the hasn't submitted anything in the past 30 hours.

It is for scientific research in the field of psychology, part of my Master's thesis. Some short explanation would be a great help, altough I'm currently crawling through the Help Wiki :)

Regards
SR
 
Assuming that you have a user element and date (or timestamp) element in the list from which the form is created (and that element is set to always default to the current time when saved), then you will have a form for each user that contains their 'last_edited' time.

Now, using that date or timestamp element to make it work is another story.
You would probably want to use the php form plugin and set it to check for your conditions 'onLoad' before the form is even rendered - and return the user to the previous page if those conditions are not met.

The first part is easy enough. In the php code for the 'onLoad' event in the php form plugin, just compare the current time to the date/timestamp - and if the difference is less than 24 hours, redirect the user back to the previous page.

As for something to trigger a notification if they hadn't updated a form within the past 30 hours - you could use the (pseudo) cron plugin (Fabrik Scheduled Tasks). Fabrik Scheduled Tasks are not true 'cron jobs', but rather require some sort of activity on the front end to trigger the execution of the cron (Scheduled Task). If you can be assured of regular activity on the front end, I guess that's not an issue. Just create a Scheduled Task that runs every xx minutes and will send emails to any users where the date/timestamp in that list is greater than 30 hours.

Your homework... :)
Date element: http://fabrikar.com/forums/index.php?wiki/date-element/
(or)
Timestamp element: http://fabrikar.com/forums/index.php?wiki/timestamp-element/
User element: http://fabrikar.com/forums/index.php?wiki/user-element/
PHP Form plugin: http://fabrikar.com/forums/index.php?wiki/php-form-plugin/
Fabrik Scheduled Tasks: http://fabrikar.com/forums/index.php?wiki/scheduled-task-plugins/
You'll also need to filter the list to the current user - http://fabrikar.com/forums/index.php?wiki/users-editing-own-records/
and/or create a menu item that links to the form pre-filtered to the current user. http://fabrikar.com/forums/index.php?wiki/joomla-user-form-plugin/#creating-a-menu-item
Everything you need to do is also included as part of the 'real-life' application tutorial: http://fabrikar.com/forums/index.php?wiki/fabrik-real-life-application-tutorials/
 
Just FYI, easiest way of ensuring scheduled tasks get triggered is to set the 'query string' arg to yes, then set up a 'real' cron job, with frequency set appropriately, that just does a wget on your site (any page, doesn't matter), with fabrikcron=1 appended as part of the query string. That guarantees your site gets hit, and the cron job will only trigger in response to those hits (and when they are due, of course).

-- hugh
 
Thank you both very much for the responses and the detailed instructions. I will work my way trough it at the weekend :)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top