Thanks for the reply! I am slowly getting there, I think… but am having issues no doubt about that.
So this is what I think the structure is;
Contact-us page pulls content from the ‘ContentTemplate’
Under elements, the template has this;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>[[*longtitle]] - [[++site_name]]</title>
<base href="[[++site_url]]" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="www.zoobaweb.co.uk" />
<meta name="description" content="[[*meta-description]]" />
<meta name="keywords" content="[[*meta-keywords]]" />
<meta name="format-detection" content="telephone=no">
<!-- GLOBAL STYLE SHEET -->
<link href="assets/css/global.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="assets/scripts/jquery-1.7.1.min.js"></script>
<!-- Include jQuery Cycyle (Production) -->
<script type="text/javascript" src="assets/scripts/jquery.cycle.lite.js"></script>
<script type="text/javascript">
$(function() {
$('#testimonial_wrapper').cycle();
});
</script>
<style type="text/css">
body {
background:url(assets/images/backgrounds/background.jpg) #4d190e no-repeat;
}
</style>
</head>
<body>
[[$html-facebook]]
<div id="WRAPPER">
<div id="HEADER">
[[$html-header]]
</div><!-- CLOSE HEADER -->
<div id="CONTENT_WRAPPER">
<div id="NAVIGATION">
[[Wayfinder? &sortOrder=`DESC` &sortBy=`menuindex` &startId=`2` &limit=`6`]]
</div><!-- CLOSE NAVIGATION -->
<div id="LEFT_COLUMN">
<div id="text_area">
<h1>[[*longtitle]]</h1>
[[*pre-code]]
[[*content]]
[[*post-code]]
[[$html-back-to-top]]
</div><!-- close text_area -->
</div><!-- CLOSE LEFT_COLUMN -->
<div id="RIGHT_COLUMN">
[[$html-right-sidebar]]
</div><!-- CLOSE RIGHT_COLUMN -->
<div class="clear"></div>
</div><!-- CLOSE CONTENT_WRAPPER -->
</div><!-- CLOSE WRAPPER -->
<!-- jQuery Back to top -->
<script src="assets/scripts/scroll-to-top/jquery.scroll.pack.js" type="text/javascript"></script>
<script src="assets/scripts/scroll-to-top/jquery.easing.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$(".toTop").scrollToTop({speed:1250,ease:"easeInOutCubic"});
});
</script>
</body>
</html>
Sorry don’t know why code-pastes aren’t working correctly. NB I have removed the image filename.
Then in the file template, FormitBuilder_BasicExample, I have this;
<?php
$snippetName='FormItBuilder_BasicExample';
require_once $modx->getOption('core_path',null,MODX_CORE_PATH).'components/formitbuilder/model/formitbuilder/FormItBuilder.class.php';
if (function_exists('FormItBuilder_BasicExample')===false) {
function FormItBuilder_BasicExample(modX &$modx, $snippetName) {
//CREATE FORM ELEMENTS
$o_fe_name = new FormItBuilder_elementText('name_full','Your Name:');
$o_fe_email = new FormItBuilder_elementText('email_address','Email Address:');
$o_fe_contact_number = new FormItBuilder_elementText('contact_number','Contact Number:');
$o_fe_notes = new FormItBuilder_elementTextArea('comments','Detail of Enquiry:',5,30);
$o_fe_captcha = new FormItBuilder_elementReCaptcha('Verification Code');
$o_fe_buttSubmit = new FormItBuilder_elementButton('submit','Submit Form','submit');
//SET VALIDATION RULES
$a_formRules=array();
//Set required fields
$a_formFields_required = array($o_fe_notes, $o_fe_name, $o_fe_email,$o_fe_contact_number);
foreach($a_formFields_required as $field){
$a_formRules[] = new FormRule(FormRuleType::required,$field);
}
//make email field require a valid email address
$a_formRules[] = new FormRule(FormRuleType::email, $o_fe_email, NULL, 'Please provide a valid email address');
//CREATE FORM AND SETUP
$o_form = new FormItBuilder($modx,'contactForm');
$o_form->setHooks(array('spam','recaptcha','email','redirect'));
$o_form->setRedirectDocument(20);
$o_form->addRules($a_formRules);
$o_form->setPostHookName($snippetName);
$o_form->setEmailToAddress('');
$o_form->setEmailFromAddress('');
$o_form->setEmailSubject(' | Enquiry - From: [[+name_full]]');
$o_form->setEmailHeadHtml('<p>This is a response sent by [[+name_full]] using the contact us form:</p>');
$o_form->setJqueryValidation(true);
//ADD ELEMENTS TO THE FORM IN PREFERRED ORDER
$o_form->addElements(
array(
$o_fe_name,$o_fe_email,$o_fe_contact_number,$o_fe_notes,
new FormItBuilder_htmlBlock('<hr class="formSpltter" />'),
$o_fe_buttSubmit
)
);
return $o_form;
}
}
//Run the form construction function above
$o_form = FormItBuilder_BasicExample($modx, $snippetName);
if (isset($outputType) === false) {
//this same snippet was called via various other hooks
return $o_form->processCoreHook($hook, $o_form);
} else {
//Final output for form
return $o_form->output();
}
Snippet screenshots;
Hope this helps, sorry for any formatting issues. I though the </> was for code entries but of course it’s mixed content.
So on the contact form, all is there aside from the reCAPTCHA ‘I am not a robot’ tickbox;