Announcement

Collapse
No announcement yet.

Form problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Form problems

    I wanted to have a catalogue subscription form and so includeed the following in a brochure page fragment:
    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">&nbsp;</td>
          <td colspan="2">
             <strong>[MailFormHeader]</strong><br /> 
             <br />
          </td>
       </tr>
       <tr> 
          <td>&nbsp;</td>
          <td>Name
          </td>
          <td>
             <input type="text" name="Name" size="50" value="" /> 
          </td>
       </tr>
       
       <tr> 
          <td>&nbsp;</td>
          <td>
             <span class="actrequired">[MailFormEmail] *</span>
          </td>
          <td>
             <input type="text" name="EmailAddress" size="50"  /> 
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
             
             Address 1
          </td>
          <td>
             <input type="text" name="Address1" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
             
             Address 2
          </td>
          <td>
             <input type="text" name="Address2" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
                Town/City
          </td>
          <td>
             <input type="text" name="Town" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
            County/State
          </td>
          <td>
             <input type="text" name="State" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
             
            Post Code
          </td>
          <td>
             <input type="text" name="Zip" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
             
             Country
          </td>
          <td>
             <input type="text" name="Country" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td >&nbsp;</td>
          <td >
             
             Telephone
          </td>
          <td>
             <input type="text" name="Telephone" size="50" value=""/>
          </td>
       </tr>
       <tr> 
          <td valign="top">&nbsp;</td>
          <td valign="top">&nbsp;</td>
          <td>
             <input type="submit" name="ACTION" value="[MailFormSendButton]" />
          </td>
       </tr>
       <tr> 
          <td valign="top">&nbsp;</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;
        }
    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

    #2
    Forms

    Thanks to all who may have looked at my request for help.
    In the end I decided life is too short so I used the form provided by 1&1 and set it to open in new window!
    Works fine!

    Christine

    Comment


      #3
      What a nice message! I'm sure if you leave it a couple of days though someone will come along with a suitable knowledge of the Perl scripts to maybe point you in the right direction.

      Good luck!
      Cheers

      David
      Located in Edinburgh UK

      http://twitter.com/mcfinster

      Comment


        #4
        I looked at this when it was posted and probably could have answered it but was discouraged by the effort required. I'd have to create a new site, put in all that customisation (none of which was within [ C O D E ] tags so somewhat unreadable) and set-up a server to handle it.

        Only when that lot was done would I be able to see what's actually happening.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X