External Forms File Location

I noticed that there is one sample external form included with the install. I wanted to try out creating an external form but I can't for the life of me find where this sample form is located in the file structure and, consequently, don't know where to create a new external form.

1. Make a new directory in the blocks/ directory in your root install, named "external_form".

2. Go into concrete/blocks/external_form/ and copy the "forms/" directory from there into the directory you just made.

3. You'll notice two files in there now, test_form.php and controllers/test_form.php. Change that to whatever you'd like your new form to be called (e.g. "contact_us.php" for both filenames.)

4. Open controllers/contact_us.php, and change

TestFormExternalFormBlockController

to

ContactUsExternalFormBlockController

Now, edit your site, and add an external form to a page. You should now see "Contact Us" as a form in the list. Add that to a page, and you should see your new form. You can edit the HTML in blocks/external_form/forms/contact_us.php, and edit what happens automatically when the form submits by modifying the action methods inside the controller. Whatever action you give your form (by default it's "test_search" will automatically run, when submit, the function that has the same name with action_ in front of it.

So, if you change your form to submit to <?=$this->action('process_contact_form')?>, you'll just need to create a method in your controller named action_process_contact_form - and it should run automatically.

I host my site directly with concrete5 and it seems that certain file locations are different. I can't find any concrete directory and, as a result, no forms as indicated. This might be due to the way concrete5 handles their hosting but I'm not sure. Any other ideas/tips?

We keep all of our core code in one place, shared between all concrete5 installs.

I've attached a zipped copy of what you'd find in the concrete/blocks/external_form/forms/ directory. You should be able to create blocks/external_form/forms/ in your local directory and use these as a starting point (Let me know if this doesn't work.)

You're touching on something I have been trying to figure out! I am implementing several concrete5 CMS's for different clients. I have customized the core app, and don't want to have to customize it each time (or copy the same files over, etc.) whenever setting up a new client.

How can I also have ONE central c5 installation, that all CMS's reference, so that I only have to keep one version customized, and up-to-date?

I don't know what he attached, either. You didn't describe much about what part of his steps you were having trouble with, you only said you can't do it. So it's a shot in the dark here, but here is the solution that worked for me:

Sorry for not being clear enough but step two in Andrew's post is what I am having trouble with. How can I find this location from the Website? I think if I knew how to locate it I might finally get the hang of these External Forms.

I assume you found your ROOT because you didn't have trouble with andrew's step 1, where he says to create a directory in blocks/ called 'external_form'.

So now go back to your ROOT.

In step 2 he says to click into concrete/blocks/external_form/ and copy the folder in there called 'forms'.

So from your ROOT, click into concrete/ then into blocks/ then into external_form/ and right-click the 'forms' folder and select Copy.

You'll paste this into the 'external_form' folder you created in step 1. So go back to your ROOT, click into blocks/ and then external_form/. Go to the Edit menu in the top left corner of your screen and select Paste. You should now see a folder called 'forms' and can continue on to step 3.

Ultimately I'll bet the confusion came from having to go back to your ROOT. If you click into the concrete/ directory from your ROOT, you'll see it looks exactly the same as your ROOT - it contains all the same folders. These are all the default source files that make your site function. It would be dangerous to edit those files directly and potentially break something that you can't fix without reinstalling Concrete5. So andrew's step 2 is basically making a copy of these source files in your ROOT so that you can work on them without causing irreparable damage to your Concrete5 installation.

It's like in Photoshop, when you start editing a photo it's always best to duplicate the original in a new layerso if you royally mess up, you still have the unedited base layer.

I actually would like to know how to do this as well. I want to create a custom external form layout (because the regular form block is too simple), but have it post the data to the reports section of the dashboard.

Just a short note to prevent some hair pulling! It's important to make sure that when changing TestFormExternalFormBlockController to your form name that you do it exactly the same as your form name without the underscores. So if your form is called my_feedback_form then you should rename the ExternalFormBlockController to MyFeedbackFormExternalFormBlockController
A bit pedantic I know but in my case I didn't realise this and it cost me some time :-)