Created
December 30, 2014 11:46
-
-
Save danielgwood/fcd0f5a646715151c603 to your computer and use it in GitHub Desktop.
Concrete5.7 external forms issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Alternative controller file - this one is actually loaded, though I'm forced to put it somewhere silly. | |
* (installed at concrete/blocks/external_form/form/controller/contact_form.php) | |
*/ | |
namespace Concrete\Block\ExternalForm\Form\Controller; | |
class ContactForm extends \Concrete\Core\Controller\AbstractController | |
{ | |
/** | |
* Sends the email. | |
* | |
* @return boolean | |
*/ | |
public function action_send() | |
{ | |
die('Loaded controller successfully'); // This works | |
} | |
/** | |
* Displays the form. | |
*/ | |
public function view() | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* View file for the form | |
* (as installed at application/blocks/external_form/form/contact_form.php, as sugggested when you add the block) | |
*/ | |
defined('C5_EXECUTE') or die("Access Denied."); | |
?> | |
<?php if(isset($response)): ?> | |
<div class="alert alert-info"><?php echo $response; ?></div> | |
<?php endif; ?> | |
<form method="post" action="<?php echo $view->action('send')?>"> | |
<input type="hidden" name="contact[subject]" id="contact_subject" value="" /> | |
<div class="field"> | |
<label for="contact_name"><?php echo t('Your name')?></label> | |
<input type="text" name="contact[name]" id="contact_name" required="required" /> | |
</div> | |
<div class="field"> | |
<label for="contact_email"><?php echo t('Your email address')?></label> | |
<input type="email" name="contact[email]" id="contact_email" required="required" /> | |
</div> | |
<div class="field"> | |
<label for="contact_message" class="label-block"><?php echo t('How can we help?')?></label> | |
<textarea name="contact[message]" id="contact_message" required="required"></textarea> | |
</div> | |
<div class="field"> | |
<input type="submit" name="contact[submit]" id="contact_submit" value="Send email" class="btn btn-primary btn-l" /> | |
</div> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller file for the form | |
* (as installed at application/blocks/external_form/form/controller/contact_form.php, which seemed to be mirror the example) | |
*/ | |
namespace Application\Block\ExternalForm\Form\Controller; | |
class ContactForm extends \Concrete\Core\Controller\AbstractController | |
{ | |
/** | |
* Sends the email. | |
* | |
* @return boolean | |
*/ | |
public function action_send() | |
{ | |
die('Loaded controller successfully'); // This never happens | |
} | |
/** | |
* Displays the form. | |
*/ | |
public function view() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment