Forms into posts
The forms into posts system is a great new addition in 11.0 to the posts toolkit in Sitekit. If a form is created of type 3 (default for new forms), then any submission to this form will be stored as posts with their post type being created automatically. The key advantage is the ease with which the form submissions can then be analysed, listed and displayed in the content tab and on front end pages like any other posts
At the bottom of the form properties window , you can now select '3' as the forms type. This sets the form to to be 'forms to posts' type. When you do this a post type with corresponding fields is automatically created.
When you submit the form on the front-end, the submissions automatically go in as posts of that type. If the post type's asset class does not permit the user to publish then when the user tries to submit the form it will show an error 'you do not have rights to publish' and return them back to the form. If the post type is set to moderated then form submissions will go in as unapproved posts.
Editing after creation
Because the post, posttype and its related form are tied together there are rules about editing them after the fact:
- Post types cannot be deleted when they are associated with a form.
- If new fields are added to the form they will automatically be added to the post type.
- If fields are deleted from the form they will NOT be removed from the post type. This is to prevent the accidental deletion of form data that has been collected already. If the user wants to definitely lose the data for the field they can delete the field from the post type.
Form field rules
A post type can have more fields than exist in the form. This would allow say a brochure request to have extra fields in the post type to give a checkbox for 'sent' and a date field for 'date sent' to be used for admin purposes.
Some special form field names can be used to map directly to standard post fields. These are:
If the form field name is set to one of these values then the standard post field will be used and a specific custom field will not be created in the associated post type
You can also add a field called 'PostPic' to the form to allow the post's pic image to be uploaded
The following permission are specific to the forms to post system
- The upload folder needs write permission for the user doing the form submission.
- The post type's asset class also needs publish permission.
- File names and permissions are validated and an appropriate error message shown at form submission if they are invalid.
In the post type editor, you can now choose a folder for form attachments. When a front-end associated form is submitted, the file attachments will be uploaded into that folder, with unique names, an asset list created and the list added to the downloads on the post. You can also add a field called 'PostPic' to the form to allow the post's image to be uploaded