Putting forms in as single pages
Permalink
I am new to Concrete5 but have years of web development experience. I am finding that when inputting forms I do seem to have enough control. So I bought an add-on although it was better - it still lacked things that I normally would have.
So the big question - If I add a form as a single page- what is the exact process. The forms that I usually use ( outside of Concrete ) are jquery ajax forms - Can I just add the form ( without the header and footer ) and include the call to jquery function ?
- Just not sure where to put the ajax action page ( the page where the variables are posted. ) or if I am not getting how it all works yet.
I think later I could look at posting form results to the report reader but for now I would just like to be able to use pre-formatted ( not editable by user ) forms and have them post to wherever I need them to ( I.e. multiple email notifications / paypal - or passed to custom pages ( dependant upon choices made while filling out forms ) i.e. Canadian tax fund totals or US tax etc.
I have found that over the years the experience that someone has while filling out forms is really important to that persons assessment of the quality of the site. So we have made it a priority to make sure that that process is as pleasurable as possible - so it would be great if I could just plug-in forms that I have already spent hours tweaking without re-writing everything.
So the big question - If I add a form as a single page- what is the exact process. The forms that I usually use ( outside of Concrete ) are jquery ajax forms - Can I just add the form ( without the header and footer ) and include the call to jquery function ?
- Just not sure where to put the ajax action page ( the page where the variables are posted. ) or if I am not getting how it all works yet.
I think later I could look at posting form results to the report reader but for now I would just like to be able to use pre-formatted ( not editable by user ) forms and have them post to wherever I need them to ( I.e. multiple email notifications / paypal - or passed to custom pages ( dependant upon choices made while filling out forms ) i.e. Canadian tax fund totals or US tax etc.
I have found that over the years the experience that someone has while filling out forms is really important to that persons assessment of the quality of the site. So we have made it a priority to make sure that that process is as pleasurable as possible - so it would be great if I could just plug-in forms that I have already spent hours tweaking without re-writing everything.
I am not 100% sure that this is what you are looking for, but this is what I found.
Go to Dashboard > Pages & Themes > Single Pages. Leave this open.
Once you have gone there, open your favorite text editor and save a blank .php file into the single_pages directory of the C5 root.
Go back to Single Pages and type in the name of the file you just created, but leave off the .php. Click Add Page.
It should show up on the top of the list now. If you go to Full Sitemap, mine showed up at the very bottom.
Naturally, you can now add you code that you want, treating it as though it was a regular .php file. I am not sure if it would work to put the code to make the form work there or not, but I know that is how you add a mostly empty page. I have not looked to see if there is a way to remove the header and footer, but there probably is a way.
Go to Dashboard > Pages & Themes > Single Pages. Leave this open.
Once you have gone there, open your favorite text editor and save a blank .php file into the single_pages directory of the C5 root.
Go back to Single Pages and type in the name of the file you just created, but leave off the .php. Click Add Page.
It should show up on the top of the list now. If you go to Full Sitemap, mine showed up at the very bottom.
Naturally, you can now add you code that you want, treating it as though it was a regular .php file. I am not sure if it would work to put the code to make the form work there or not, but I know that is how you add a mostly empty page. I have not looked to see if there is a way to remove the header and footer, but there probably is a way.
You might want to look at JohntheFish's addon which enacts the various ways C5 uses AJAX.
http://www.concrete5.org/documentation/how-tos/developers/ajax-less...
http://www.concrete5.org/documentation/how-tos/developers/ajax-less...
From your description, you are looking at more than just a form. You are looking at a mini application where filling in the form is just the front end of it.
As @jvansanten noted, my Ajax Lessons addon is a place to start learning about ajax mechanisms in concrete5.
While the site specific single pages (or blocks and tools) could work for this, personally I would put this into a package, even if it was just for one site.
For flexibility, I would structure the functionality into blocks rather than single pages (this is not that different to single pages because your front end form is saved by an ajax transaction), that way you can put the blocks where you want on other pages.
- One block to show the front end form as a block view.
- A tool file to handle the ajax transaction from that block and save to a database table.
- A package level database table (ie shared across the package, not tied to just one block) for that data.
- A second block (or more) that you can then use to show collated information from the first block. (Or maybe a dashboard page to do that if you don't want to show it to end users.)
- A package controller to install it and tie it together.
- A model file/class to encapsulate the package level database table
This is a fairly generic mini-application architecture that can be adapted to all sorts of things.
As a learning resource, I strongly recommend Remo's book to get you started on transferring your existing knowledge into concrete5.
As @jvansanten noted, my Ajax Lessons addon is a place to start learning about ajax mechanisms in concrete5.
While the site specific single pages (or blocks and tools) could work for this, personally I would put this into a package, even if it was just for one site.
For flexibility, I would structure the functionality into blocks rather than single pages (this is not that different to single pages because your front end form is saved by an ajax transaction), that way you can put the blocks where you want on other pages.
- One block to show the front end form as a block view.
- A tool file to handle the ajax transaction from that block and save to a database table.
- A package level database table (ie shared across the package, not tied to just one block) for that data.
- A second block (or more) that you can then use to show collated information from the first block. (Or maybe a dashboard page to do that if you don't want to show it to end users.)
- A package controller to install it and tie it together.
- A model file/class to encapsulate the package level database table
This is a fairly generic mini-application architecture that can be adapted to all sorts of things.
As a learning resource, I strongly recommend Remo's book to get you started on transferring your existing knowledge into concrete5.
You might want to look into ProForms. It's very extendable. You can create custom input types with custom validation. Creating custom questions is exactly the same as creating custom attribute types. It's very granular.
ChadStrat
ChadStrat
And Ideas?