Example of complex external form

Permalink
I'm learning external forms stuff and I have to say it has been way harder than anything else with Concrete. I should make 4 fairly large registration forms to sports event, so basically I need to do some form validation, storing results to database and mailing them, and some kind of interface to dashboard as normal Form block has.

I 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.

orisinal
 
orisinal replied on at Permalink Reply
orisinal
Anyone? Anything? At the moment I'd just like to see how you've done controller and how errors are handled.
okhayat replied on at Permalink Reply
okhayat
To my knowledge, creating External Forms, is simply like 'including' them within C5. You create your simple/complex form with Javascript/PHP validation and include it using the block and that's it.
There is really nothing special related to C5 that has to be done to use your form using the block.
orisinal replied on at Permalink Reply
orisinal
That's right, but I think that Concrete has many helper functions that can be used with external forms, but learning curve of using them is quite steep. Basically only way to learn them is to take a look at core files and figuring out why they're coded like that. It can be good way to learn things for some people, but usually very time consuming and too hard for some of us.
synlag replied on at Permalink Reply
synlag
Easy, as an external form isn't anything else than a single page without a controller.

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...
orisinal replied on at Permalink Reply
orisinal
Synlag, thanks for your answer and sorry for being straightforward, but... ;)

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.
synlag replied on at Permalink Reply
synlag
it's similiar to a single page, sry for the confusing.
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.
orisinal replied on at Permalink Reply
orisinal
Yes, at the beginning I thought I could look help from Form block or use it's single pages as base for reports, but after some researching it felt very bad approach. I found that form block should be remade as it's one of the most complex blocks in Concrete5 and code is actually quite spaghetti, not reusable at all. That was opinion of someone in core team in some thread, not mine. In #concrete5 I was told too, that using Form block's report page for external form is very difficult.

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...
webjedi replied on at Permalink Reply
webjedi
So did you solve this easily?
I just want to insert a few forms and not mess with creating a block right now.

CAn I just include the form ?

WJ
orisinal replied on at Permalink Reply
orisinal
No, I didn't. If your forms are not very complicated, try to do them by using the Form block.

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.
Ricalsin replied on at Permalink Reply
Ricalsin
I really do concur with your frustration, as I'm just now trying to solve the problem you faced 3 months ago or so...

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.
Ta2Ta2 replied on at Permalink Reply
Hello everybody,

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?
tildy replied on at Permalink Reply 1 Attachment
tildy
Hi, I'd like to create a custom external form , which contains a customized ( designed) file upload method .
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?