Example of complex external form
PermalinkI think this is very common usage of external forms and I'm bit surprised why this forum isn't filled with threads that deals with external forms. Is it really that easy to learn?
I don't ask anyone to make these forms for me, but it would be very helpful if we could have some examples of more complex form. The default text_form.php is bit too simple in my opinion.

There is really nothing special related to C5 that has to be done to use your form using the block.
Defined('C5_Execute') or die;
Loader::Helper('form');
$my_form = new FormHelper();
$my_form->checkbox(...);
$my_form->action('/tools/my_form_action_handler');
and so on.
what's needed a file for actions and a single page at reports that lists your submitted external forms...
Have you ever checked the example form and controller in /concrete/blocks/external_form/forms/ ? I'm not sure what do you mean by "...external form isn't anything else than a single page without a controller" as it definately looks that external forms are intended to be used with controllers. And why would you send form to "/tools/my_form_action_handler" instead of "process_my_form"? It's handled automatically in action_process_my_form method of controllers/my_form.php.
Moreover your code example doesn't print anything as helper functions are not echoed. Action should be echoed in <form action="HERE"> and... Eh. I know that you probably wrote the code from your head and it was just a quick and dirty example, but again, it can confuse beginners. Better start for newbies is to take a look at andrew's first answer in
http://www.concrete5.org/community/forums/chat/external_forms_file_...
Outputting the form fields, labels etc. isn't the hard part, but nice validating, data storing, mailing etc. is the challenging area that can get really messy and hard to maintain. So again: If anyone has nice controller that does anything in that area, I'd be glad to see the form and the controller. Also other ideas and approaches are welcome, like how to make working with forms easier and more efficient, some useful 3rdparty classes etc.
Answer preferably by replying to this thread, but if you don't want to show it in public, just send me private message.
i've checked the block.
You can use any controller for that you like, it doesn't matter where it resists.
Maybe it's possible to use the form blocks controller for your external forms, to make them visible at dashboard->reports.
Maybe I start to ad hoc rest of the forms just to make them work, no matter how, as deadline is very close now... One is 90% done, but there are 3 forms left. What a pain to make changes for these...
I just want to insert a few forms and not mess with creating a block right now.
CAn I just include the form ?
WJ
Requirements for my forms changed and I didn't have to store the results into database. My External forms sent emails by using Concrete5's mailing helpers and all the emails were logged automatically, so even if something goes wrong in mail transfer, the sent mail can be found from the log.
I understand the File/User/Pages in C5 ship with their own attribute key/value feasibility, but they are not tied together (,right?). In other words, I can create key/values within the file section but then I have no ability to load into those key/values from a form I create using either the default form block or the extended form block. Those two form blocks store and display information separate from the file block (Document Library)- making information attained within a form/file upload unusable to the Document Library. Is this understanding correct?
I am asking NOT out of disrespect for Concrete5 - a program I find heading in the right direction. I am asking because I have found myself trying to do stuff before that was already provided for in C5 - but I was unaware because I had not discovered the documentation on it. Am I missing more documentation, or is the solution to hack the form block by redirecting the post - and is that possible???
Thanks. And again, I appreciate the C5 effort and community.
I managed to get the external form works fine for me however, my custom form is a lead generation form that will collect data been submitted and post them into SalesForce. Then the client will be redirected to thank you page!
My issue is, to redirect the client back to thank you page that will start downloading files automatically.
It never works for me, any idea?
I can see the page, and the upload form, but nothing happen .
(I nedd a custom form, because I don't need a label for a file uplaod, and I'd like to create style for the fileupload input )
How can I see the uploaded file on the backend, and do you have any idea what's wrong with my code?