Jump to content

Is it possible populate site pages from a form submission? Adding content without admin access


einsteinsboi
 Share

Recommended Posts

I am building a site where I need to create and populate pages based on the content inserted into a form by a site visitor. Is this possible using Form Builder or some other method?

My basic idea is that I will create a template with certain fields. I would then create a form with the same fields, and then provide the url to that form to people who are authorized and want to create pages on the site. Once they fill the form, I would like to have that information saved to the database and a page created with the info from the form, with the page title and url automatically generated from one of the fields. I obviously don't want to give everyone access to admin backend to create pages so i thought this would be a good alternative, but I'm open to suggestions. 

As a plus, it would be great if these pages were unpublished by default so that I have a chance to approve and publish them before they go live.

Any and all thoughts are welcome and appreciated :)

Link to comment
Share on other sites

Yes, this is possible :)

There are several options you could look at. The first one is if you feel comfortable tackling this with some code, and you don't need to do this in the control panel interface. There's a module called Form Template Processor

Module to let you use templates as web contact forms. Can send you email and/or save the submission to a page in your site.  Intended to be a starting point and proof-of-concept, so you may want to take this further. 
 

The second option is to use the brilliant Form Builder module, which (amongst other things): "Saves entries to a database, email, ProcessWire page, 3rd party service, auto-responder, or any combination of these".

Another option would not be to use any modules. If you do it this way, you use your page templates to manually create the form and input fields (using plain HTML, or ProcessWire's API to load Inputfields) as well as processing the data upon submission and then creating the resulting page.

  • Like 2
Link to comment
Share on other sites

Mary, there are several examples on the forums. Soma has a very nice tutorial here http://processwire.com/talk/topic/2089-create-simple-forms-using-api/?hl=%20soma%20%20forms, I also came up with a system to do it easily, but only for "normal" fields (text, texareas, etc...) http://processwire.com/talk/topic/59-module-want-form-builder/?p=11639

  • Like 1
Link to comment
Share on other sites

I've recently built out a site that does exactly what you are describing. Users can create an account. Once approved as an editor, they have the opportunity to "submit new product" or "edit this product" (appears when viewing a product page). The submissions go into a FormBuilder queue, where the site managers review and approve them. When approved, they go straight into a page (whether new or existing), and the entry gets automatically deleted. The edit product form essentially looks like this (even though this is technically the search page). I would link to it directly, except they wanted the add or edit form submissions to be limited to registered users. All the forms on this site, including user registration, login, search and edit/add products are all done through FormBuilder. Though FormBuilder is not a turn-key solution for this stuff, as some development was still involved (primarily via FormBuilder hooks). But this site had to be developed in a very short period of time (a few days) so FormBuilder and the Foundation profile came in handy. :) 

  • Like 3
Link to comment
Share on other sites

Ryan

Thanks for your reply. That site looks really nice :)  I've been planning to get FormBuilder to play with and start incorporating into my websites, so this is timely :)  The ability to hold the form submissions in a queue awaiting approval is exactly what I need.  One thing I need to verify: I assume the users have the ability to edit just the page they've created and no others, is that correct? If yes, how did you set this up? I would like users to only be able to edit the pages they create and not see the admin area for any other page. 

I've recently built out a site that does exactly what you are describing. Users can create an account. Once approved as an editor, they have the opportunity to "submit new product" or "edit this product" (appears when viewing a product page). The submissions go into a FormBuilder queue, where the site managers review and approve them. When approved, they go straight into a page (whether new or existing), and the entry gets automatically deleted. The edit product form essentially looks like this (even though this is technically the search page). I would link to it directly, except they wanted the add or edit form submissions to be limited to registered users. All the forms on this site, including user registration, login, search and edit/add products are all done through FormBuilder. Though FormBuilder is not a turn-key solution for this stuff, as some development was still involved (primarily via FormBuilder hooks). But this site had to be developed in a very short period of time (a few days) so FormBuilder and the Foundation profile came in handy. :)

Link to comment
Share on other sites

One thing I need to verify: I assume the users have the ability to edit just the page they've created and no others, is that correct? If yes, how did you set this up? I would like users to only be able to edit the pages they create and not see the admin area for any other page

In this particular case, the users don't get to directly edit a page they just created. That's because when they submit a form, it doesn't go straight to a page. The admin sees the form submission in the FormBuilder entries queue, and then they decide whether it gets sent to a page (by checking a box and clicking 'send to page'). Subsequent edits work the same way. This was specific to the needs of this client. The reality is most of the logic of how you want it to work is using traditional PW API code rather than anything FormBuilder related. Though in this case much of that code is placed inside of FormBuilder hooks. On it's own, FormBuilder is basically a contact form generator with lots of options about where the data goes, and it's not necessarily going to be the right tool for implementing more complex application logic forms. Though it can be used for that, but I think most are better off sticking to PW API when it comes to these kinds of needs. That's because using the PW API, you can make it do exactly what you want without considering too many other factors. 

Link to comment
Share on other sites

  • 3 years later...
On 11/23/2013 at 6:04 AM, ryan said:

In this particular case, the users don't get to directly edit a page they just created.  

This is exactly what I am doing... and I am using your formbuilder.  I have a couple of registration forms - one shorter, one longer.  The submissions are tagged as either subscribers or contributors and sent manually, to the document tree where I created:

users
--subscribers
-----name
--contributors
-----name


Contributors have access to the submission form pages that work like the example you cited to send data but not edit. Subscribers have access to view full detail pages, but they don't submit anything.

Getting these entries into Admin > Access > Users is the question.

It seems that users should be managed through this  internal function since that provides login, reset password, etc. And in the back end, I can always add users manually, but I'm not sure (read: clueless) as to how to get those three fields: email, name, roles from the collected form entry into users...

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...