FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quota restriction
#1
Question 
First of all I would like to say FormTools is an excellent tool, have been using it over a year now.

I was wondering is it possible to set a quota restriction on the form? Say if the quota exceeds the limit it will trigger a different auto-reply email?

This is extremely useful when I use it as event registration form.

Regards,
Jackson Chan
Reply
#2
Hi Jackson,

Yeah, I can totally see the need for this. Unfortunately I can't think of any terribly good way to do this right now.

But here's a hack way, in case you're curious.

- Create a new field to your form called "is_full" (just within Form Tools - you don't need to add it to your actual form).

- Create a new Submission Pre-Parser rule - see: http://modules.formtools.org/submission_pre_parser/
This would get triggered for all new submissions. In the code, I'd query the database, find out how many submissions have added so far and if it's over the total permissable # of registrations (say 400 or whatever) I'd set "is_full" to "yes". If not, set it to "no".

- I'd then create two new Views:
One called "Registration Full" and add a Standard Filter to limit all results in the View to only show those submissions with "is_full" set to "yes".
The second called "Registration Open". This would be just like the other one, except only show submissions where "is_full" is set to "no".

Lastly, all you'd need to do is map your email templates (the "thanks for registering!" and "sorry, registration full!" email templates) to those Views. That way they'll get sent only when a submission fits into one of those Views - i.e. when the registration is full or not.

It's NOT great, obviously. But it would certainly work...!

Let me know if you need any pointers. I kind of glossed over the SQL bit. Smile

- Ben



Reply
#3
Dear Ben,

Wow! Thank you so much for your reply.

Yes I did take a look at the Submission Pre-Parser, but I didn't know you can do SQL query in there too. I thought it's only for form data processing.

Your solution will definitely work, if I know how to put SQL query in the PHP code. Would you please give me a place to look for samples?

Thank you so much.

Regards,
Jackson
Reply
#4
Dear Ben,

Another question, yes I understand we can set email triggers based on different views. But is there any way to "play" with the redirected page? (Thank you page), possible to redirects to different return message?

Regards,
Jackson
Reply
#5
I'm still wondering how to "find out how many submissions have added so far", is there a var I can get this value?

Thanks!
Reply
#6
Hey Jackson,

(Dec 13th, 2010, 7:31 PM)jacksonc@ust.hk Wrote: I'm still wondering how to "find out how many submissions have added so far", is there a var I can get this value?

Sure! There's actually a handy Form Tools Core function for this. You can call it in either of these ways:

PHP Code:
$num_submissions ft_get_submission_count($form_id);
$num_view_submissions ft_get_submission_count($form_id$view_id); 

The first way returns the number of submissions in the form - the second, the number of submissions in a form View.

In both cases, you'll need to pass the specific form ID and form View ID that you're interested in. You can use this core right in the Submission Pre-Parser rule.

Quote:is there any way to "play" with the redirected page? (Thank you page), possible to redirects to different return message?

Excellent question. Yes! There's a couple of ways. If you have a POST form, you can always include a hidden field:

Code:
<input type="hidden" name="form_tools_redirect_url" value="http://www.whatever.com" />

If that value is defined, the form will redirect to that URL and not the "redirect URL" value stored for the form. Basically it just lets you override the default value.

Simililarly, you can also set that value in your Submission Pre-Parser rule to dynamically determine the redirect URL:

PHP Code:
$_POST["form_tools_redirect_url"] = "http://whatever.com"

To be perfectly honest, I haven't tried this in a while - but that was how I originally coded it and I don't think anything's changed. Smile

Anyway, let me know if you have any problems with the above or have any other questions!

- Ben

Reply
#7
Dear Ben,

Fantastic !! You are wonderful, thank you so much !!!!

Regards,
Jackson
Reply
#8
I've successfully implemented it and using it for Event Registration, works perfectly!
Reply
#9
Congratulations!! Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)