Sorry to resurrect this thread but the same thing has started happening again. This time, I made sure there was no trailing comma, as the above solution suggested.
The same symptoms again but this time, I cannot make it happen from the footer by adding the form code (living inside a chunk) directly in the footer code.
I don't think it matters, but the form code lives inside a chunk called "footer_form_code". That chunk gets called up within the footer code, which is itself a chunk, called "footer". The footer chunk then gets called up in the template.
Also, I don't think it matters but figure I'll mention it: this site is running with user friendly URLs on, although the domain is not propagated to it yet. Working on it through IP address. As in,
http://xxx.xxx.xxx.xx/~client/index.php.
This time, the "footer_form_code" chunk displays the same problem, even if I place the chunk directly within the template. For testing purposes, I took another form code chunk, from another project that I know works, and placed it in the footer to see if that runs. Nope.
I tried taking the form code directly out of the chunk and place it, as is, on the template directly. Same problem. The page doesn't submit and just refreshes.
Interestingly, I take the "footer_form_code" chunk and place it on the page through a template variable (on that page I happen to have a TV under the content to optionally place code there if I want to...it's a standard practice with me on most sites).
In that case, it works. Something about running it through a TV is making it work.
What is going on here? Below is all the code that is coming into play.
Chunk called footer_form_code:
[[!FormIt?
&hooks=`spam,hook.RampartFormIt,FormSave,email,emailUser-footer,redirect`
&emailSubject=`Submission from XXXXXXX Website Footer Mailing List Form`
&emailTpl=`EmailChunk-footer`
&emailTo=`[email protected]`
&redirectTo=`12`
&fsFormTopic=`Footer-Contact`
&fsFormFields=`firstName,lastName,company,email`
&validate=`firstName:required,lastName:required,email:required`
]]
[[!+fi.error.error_message:notempty=`
<p>[[!+fi.error.error_message]]</p>
`]][[!+fi.error.rampart]]
<form class="form" action="[[~[[*id]]]]" method="post">
<div id="footer_form_first_name"><input name="nospam:blank" type="hidden" />
<label for="firstName">First Name:<span class="error">[[+fi.error.firstName]]</span></label>
<input name="firstName" type="text" class="footer_form_first_name" value="[[+fi.firstName]]" />
</div><!-- /footer_form_first_name -->
<div id="footer_form_last_name"><input name="nospam:blank" type="hidden" />
<label for="lastName">Last Name:<span class="error">[[+fi.error.lastName]]</span></label>
<input name="lastName" type="text" class="footer_form_last_name" value="[[+fi.lastName]]" />
</div><!-- /footer_form_last_name -->
<div id="footer_form_company_name"><input name="nospam:blank" type="hidden" />
<label for="company">Company Name:</label>
<input name="company" type="text" class="footer_form_company" value="[[+fi.company]]" />
</div><!-- /footer_form_company_name -->
<div id="footer_form_email"><input name="nospam:blank" type="hidden" />
<label for="email">Email Address:<span class="error">[[+fi.error.email]]</span></label>
<input name="email" type="text" class="footer_form_email" value="[[+fi.email]]">
</div><!-- /footer_form_email -->
<input type="hidden" name="subject" id="subject" value="Submission from XXXXXXX Website Footer Mailing List Form" />
<input name="Submit_Button" class="footer_form_submit_button" title="Submit_Button" type="submit" value="">
</form>
emailTpl chunk called EmailChunk-footer:
<br />[[+firstName]] [[+lastName]] ([[+email]]) wrote:<br /><br />
First Name: [[+firstName]]<br />
Last Name: [[+lastName]]<br />
Email Address: [[+email]]<br />
Company Name: [[+company]]
confirmationTpl chunk called ConfirmationTpl-footer:
Hello,[[+firstName]] [[+lastName]]:
<p>Thank you for your interest in XXXXXX! Please provide a few days for a response to any questions or concerns you may have.</p>
Confirmation snippet called emailUser-footer:
<?php
//configuration
$mailFrom = $modx->getOption('emailsender'); //OR USE YOUR OWN;
$mailFromName = $modx->getOption('site_name'); //OR USE YOUR OWN;
$mailSender = $modx->getOption('site_name'); //OR USE YOUR OWN;
$mailSubject = 'Thank You for XXXXX';
$mailReplyTo = $mailFrom;
//get fields values so they can be replaced in the email chunk
$confirmationFields['firstName'] = $scriptProperties['fields']['firstName'];
$confirmationFields['lastName'] = $scriptProperties['fields']['lastName'];
$confirmationFields['company'] = $scriptProperties['fields']['company'];
//get user's email
$mailTo= $scriptProperties['fields']['email'];
$text = $modx->getChunk('ConfirmationTpl-footer', $confirmationFields);
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$text);
$modx->mail->set(modMail::MAIL_FROM,$mailFrom);
$modx->mail->set(modMail::MAIL_FROM_NAME,$mailFromName);
$modx->mail->set(modMail::MAIL_SENDER,$mailSender);
$modx->mail->set(modMail::MAIL_SUBJECT,$mailSubject);
$modx->mail->address('to',$mailTo);
$modx->mail->address('reply-to',$mailReplyTo);
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$err);
return false;
}
$modx->mail->reset();
return true;
Formit 2.1.2
MODx Revo 2.2.5-pl
[ed. note: waizen last edited this post 13 years, 9 months ago.]