Use formidable for class booking

Hello, i’m been using formidable for several sites now. It’s been worth every dollar i spent for the pro version!

Now i’m planing to use it for some more advanced purposes. I have created custom post types for different classes in a school. I want to make a form where pupils can sign up for a class. But i want it to be limited spots in every class, so when someone register for a class the number unfilled spots will be subtracted by one. When the class is full the registration form for that class will be stopped.

Is this possible to do with formidable? Some tips on which way to go please :)

Thanks in advance.

This is an advanced customization. Here's an example of decreasing the number available:
http://formidablepro.com/knowledgebase/frm_after_create_entry/#kb-decrease-an-available-count-in-another-form

For changing the available classes shown in the schedule form, you'll use this hook.
http://formidablepro.com/knowledgebase/frm_setup_new_fields_vars/

Or you can return an error if they try to schedule a full class.
http://formidablepro.com/knowledgebase/frm_validate_field_entry/

This is very advanced so you will likely need to hire a developer if you are not comfortable with PHP.

Thank you for your fast reply. I haven't got the time to start with this project yet. Thank you for the examples! But my idéa is to only use one form for each class and to use the "Custom Post Type" function in wordpress 3+. I'm using a plugin thats called "more fields" it adds an extra meta field to the post editor. I have a meta that's "Seats left:".

Basically I want Formidable to interact with a meta field from the post where the form is published.

I found using custom post types makes it very easy for my client to manage data by himself, it would be even better if I can interact Formidable with a single post.

Is this possible? I have basic knowledge of PHP, I understood the examples above...

Thanks again :)

You can create your custom posts with Formidable. Is that what you're asking?
http://formidablepro.com/knowledgebase/create-a-post-form-and-display-the-results/

That's a cool feature, but not really what im looking for. I'm going to describe it more clearly...

1. I have a "Custom post type" that is called "Classes".

2. If the teacher wants to add a new class, he logs in to the back-end of wordpress. Clicks the new class under classes. Fills in the fields I have created for that special post type, name of class, date, seats etc. then posting.

3. The new class pops up on the front end, with all the other classes.

4. Pupil navigates to the front-end of the site to go book a class. He clicks the class he wants to book, the single post for just that class pops up. With a form from Formidable where he can submit his name, age etc. He clicks book, gets a e-mail confirmation.

5. Lets say there was only two seats for that class, so when he gets back to where he can choose classes, it has now changed to only one seat left.

6. When the teacher logs in to the back-end of wordpress he can still add seats to that class by clicking "Classes"(the custom post type i have made", edit class and change the meta value in the custom meta field.

So every time "x-form" in the "x-post" returns true the "x-posts" meta value for seats should get subtracted by one.

I want it to be simple. The teacher shouldnt have to worry about how to manage formidable, just how to edit the post type for  "classes".

Thanks again for fast replies.

:)

Are you saying the booking form would be shown at the bottom of the single post page? If so, you can use dynamic default values to get the post meta you have added in hidden form fields in combination with custom code.
http://formidablepro.com/knowledgebase/using-dynamic-default-values-in-fields/

You'll need to work out the custom code on your own for updating the post meta. You can use those examples linked above to get you started. If you're not familiar with PHP and WordPress functions, you may need to hire a developer.

Thank you,

One last thing...

I have the form in a post, when user press submit, I want a post_meta value for that post to be subtracted by one.

I guess I have to use:
add_filter('frm_after_create_entry', 'after_entry_created', 30, 2);
function after_entry_created($entry_id, $form_id){
if($form_id == 5){ //change 5 to the ID of your form
//do stuff here
}
}
But how do i target my post_meta value for just that post that the form is in?
Thanks!

Please see this related post:
http://formidablepro.com/help-desk/form-within-a-form-2/

Thank you, but i already figured it out.

This is what i came up with:

add_filter('frm_after_create_entry', 'after_entry_created', 30, 2);
function after_entry_created($entry_id, $form_id){

global $post;

if($form_id == 7){ //change 7 to the ID of your form

$value = $_POST['item_meta'][103]; // Hidden field with subtracted value

update_post_meta($post->ID, 'seats', $value);

}
}

Topic closed.