I wanted to have a catalogue subscription form and so includeed the following in a brochure page fragment:
The problem is that when you press send the standard "contact us" e-mail form opens. So I get a message from the client asking for a catlogue but not their address details. I have made a basic error in the Send code or is it a more fundamental scripting error?
Thanks
Christine
www.wildsidebooks.co.uk
Code:
!!<<strong>>!!!!<<span style='color: #800000;'>>!!CATALOGUE SUBSCRIPTION!!<</span>>!!!!<</strong></br> <form method="post" action="[SendMailPageURL]"> <input type="hidden" name="RANDOM" value="[Random]" /> [ValidationError] <input type="hidden" name="Subject" value="Catalogue"/> <table cellpadding="3" cellspacing="0"> <tr> <td width="15"> </td> <td colspan="2"> <strong>[MailFormHeader]</strong><br /> <br /> </td> </tr> <tr> <td> </td> <td>Name </td> <td> <input type="text" name="Name" size="50" value="" /> </td> </tr> <tr> <td> </td> <td> <span class="actrequired">[MailFormEmail] *</span> </td> <td> <input type="text" name="EmailAddress" size="50" /> </td> </tr> <tr> <td > </td> <td > Address 1 </td> <td> <input type="text" name="Address1" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > Address 2 </td> <td> <input type="text" name="Address2" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > Town/City </td> <td> <input type="text" name="Town" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > County/State </td> <td> <input type="text" name="State" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > Post Code </td> <td> <input type="text" name="Zip" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > Country </td> <td> <input type="text" name="Country" size="50" value=""/> </td> </tr> <tr> <td > </td> <td > Telephone </td> <td> <input type="text" name="Telephone" size="50" value=""/> </td> </tr> <tr> <td valign="top"> </td> <td valign="top"> </td> <td> <input type="submit" name="ACTION" value="[MailFormSendButton]" /> </td> </tr> <tr> <td valign="top"> </td> <td colspan="2" valign="top"> [RequiredFields] <span class="actrequired">[Highlighted]</span>. </td> </tr> </table></form>>!! I then altered the Mail Form pl as follows: sub SendMailToMerchant { # # Receive parameters from input hash # my ($sEmailRecpt, $sSubject, $sTextMailBody, $sName, $sMessage, $sEmailAddress, $sAddress1, $sAddress2, $sTown, $sState, $sZip, $sCountry, $sTelephone, $sHTML); $sEmailRecpt = $::g_InputHash{'EmailAddress'}; $sSubject = $::g_InputHash{'Subject'}; $sName = $::g_InputHash{'Name'}; $sMessage = $::g_InputHash{'Message'}; $sEmailAddress = $::g_InputHash{'EmailAddress'}; $sAddress1 = $::g_InputHash{'Address1'}; $sAddress2 = $::g_InputHash{'Address2'}; $sTown = $::g_InputHash{'Town'}; $sState = $::g_InputHash{'State'}; $sZip = $::g_InputHash{'Zip'}; $sCountry = $::g_InputHash{'Country'}; $sTelephone = $::g_InputHash{'Telephone'}; # # Validate the content of the fields # my $sError; if ($sName eq "") { $sError .= ACTINIC::GetRequiredMessage(-1, 2370); } if ($sSubject eq "") { $sError .= ACTINIC::GetRequiredMessage(-1, 2372); } if ($sEmailRecpt eq "") { $sError .= ACTINIC::GetRequiredMessage(-1, 2371); } elsif ($sEmailRecpt !~ /.+\@.+\..+/) { $sError .= ACTINIC::GetPhrase(-1, 2378) . "\r\n"; } if ($sMessage eq "") { $sError .= ACTINIC::GetRequiredMessage(-1, 2373); } if ($sError ne "") { $sError = ACTINIC::GroomError($sError); # make the error look nice for the HTML $ACTINIC::B2B->SetXML('VALIDATIONERROR', $sError); # # Redisplay the mail page with error messages # DisplayMailPage($sName, $sSubject, $sEmailRecpt, $sMessage); # # Note: the above call will never return here # } else { # # Construct the mail text and send it to the merchant # $sError = ACTINIC::GetPhrase(-1, 2377); $sTextMailBody .= ACTINIC::GetPhrase(-1, 2370) . $sName . "\r\n"; $sTextMailBody .= ACTINIC::GetPhrase(-1, 2371) . $sEmailRecpt . "\r\n"; $sTextMailBody .= ACTINIC::GetPhrase(-1, 2373) . "\r\n" . $sMessage . "\r\n\r\n"; $sTextMailBody .= "EmailAddress:" .$sEmailAddress. "\r\n"; $sTextMailBody .= "Address1:" .$sAddress1. "\r\n"; $sTextMailBody .= "Address2:" .$sAddress2. "\r\n"; $sTextMailBody .= "Town:" .$sTown. "\r\n"; $sTextMailBody .= "State:" .$sState. "\r\n"; $sTextMailBody .= "Zip:" .$sZip. "\r\n"; $sTextMailBody .= "Country:" .$sCountry. "\r\n"; $sTextMailBody .= "Telephone:" .$sTelephone. "\r\n"; my @Response = ACTINIC::SendMail($::g_sSmtpServer, $$::g_pSetupBlob{EMAIL}, $sSubject, $sTextMailBody, $sEmailRecpt, $sEmailAddress, $sAddress1, $sAddress2, $sTown, $sState, $sZip, $sCountry, $sTelephone ); if ($Response[0] != $::SUCCESS) { ACTINIC::RecordErrors($Response[1], ACTINIC::GetPath()); $sError = $Response[1]; } # # Now bounce back to the mail page # @Response = ACTINIC::BounceToPageEnhanced(5, ACTINIC::GetPhrase(-1, 1962) . $sError . ACTINIC::GetPhrase(-1, 1970), $$::g_pSetupBlob{CHECKOUT_DESCRIPTION}, $::g_sWebSiteUrl, $::g_sContentUrl, $::g_pSetupBlob, $::Session->GetLastShopPage(), \%::g_InputHash, $::FALSE); $sHTML = $Response[2]; # # We need to manually remove the <Actinic:UNREG> tags from the bounce page # $sHTML =~ s/<Actinic:UNREG>.*?\/Actinic:UNREG>//isg; } ACTINIC::SaveSessionAndPrintPage($sHTML, undef); exit; }
Thanks
Christine
www.wildsidebooks.co.uk
Comment