Beginner question. Can someone please explain why would I use forms?
I’m building a news site and i’m using cockpit to manage the data and php/slim framework to query the data via the cockpit api or directly from the database. It seems to me that I only need to use collections and singletons and I’m not sure why I need to use forms.
Could be maybe to build a commenting system similar to wordpress? but even then can’t I use collections?
It would be nice if someone can clarify.
just take a look at the docs
Forms are a great way to receive input from your users. It is usually painful to set up a server-side form processing script, and that's where Cockpit forms come to help.
Cockpit offers you a way of gathering form submissions as entries that can be viewed in the dashboard.
comments for your page would require you to have a form for each post you make I guess (not quite sure).
But you couls perhaps achieve your goal with a collection that has the ACL for everyone to create entries.
Thanks. It’s not clear to me how Cockpit “come to help”. It seems from the documentation that I will still have to write the client-side code to submit the form data via the api. So the question is why I don’t submit to a collection instead and what’s the difference?
Interesting thought… I wasn’t sure about it first. If you don’t use the backend, there is no big difference. You can setup your cockpit to send mails for new collection entries with a custom config script and you don’t even have to define all fields, which are sent to the collection. All sent data gets stored and it is visible if you fetch it.
The big differences are the visual defaults in the backend and some background logic. The collection overview page is more for managing entries. If you want to read them, you have to click and open them. Before you can see any entry, you have to define fields with the proper names. Also, collection entry views are meant to be able to change contents.
The forms overview lists all entries and you can read it fast. You don’t have to define any field. Everything is visible by default. Form fields are readonly by default and you can setup a mailer by entering just a mail adress in the settings.