//Set required fields
$a_formFields_required = array($o_fe_notes, $o_fe_name, $o_fe_email);
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 JsonFormBuilder($modx, 'contactForm');
$o_form->setRedirectDocument(3);
$o_form->addRules($a_formRules);
//////////////////
//AUTO RESPONDER//
//////////////////
//Set email addresses and format
$o_form->setAutoResponderToAddress($o_form->postVal('email_address'));
//this must be the field ID for your return email, NOT the email address itself
//You can also use an array of email addresses to send to multiple TO addresses.
$o_form->setAutoResponderToAddress(array('*****@*****.**', '*****@*****.**'));
$o_form->setAutoResponderFromAddress('*****@*****.**');
$o_form->setAutoResponderFromName('Business Title');
$o_form->setAutoResponderReplyTo('*****@*****.**');
//Set the email subject and content
$o_form->setAutoResponderSubject('Business Name - Thanks for contacting us!');
$o_form->setAutoResponderEmailContent('<p>Thank you for contacting us. We will get back to you as soon as possible. Your submitted information is listed below.</p>{{tableContent}}<p>Thanks again!</p>');
//In most cases these probably will not be used, but you can also send the responder to a CC and BCC address.
//$o_form->setAutoResponderCC('*****@*****.**');
//$o_form->setAutoResponderBCC('*****@*****.**');
$o_form->setJqueryValidation(true);
$o_form->setPlaceholderJavascript('JsonFormBuilder_myForm');
//ADD ELEMENTS TO THE FORM IN PREFERRED ORDER