Announcement

Collapse
No announcement yet.

Custom Contact Form on within a Fragment

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

    Custom Contact Form on within a Fragment

    Hi,

    I have created a Contact Form that previously works within a normal HTML page outside Actinic.
    The link to the page is:
    http://www.wheels.uk.com/acatalog/suspension.html

    It is currently set up like this:
    <form method="post" action="[SendMailPageURL]">
    <input type="hidden" name="RANDOM" value="[Random]" />
    <div align="left">
    <input type='hidden' name="recipient" value="john@wheels.uk.com"/>
    <input type='hidden' name="subject" value="Suspension Form Results"/>
    <input type='hidden' name="redirect" value="http://www.wheels.uk.com/acatalog/thanks-email.html"/>
    <table width="400" border="0" align="center" cellpadding="2">

    *****REST OF HTML CODING*****
    </table>
    </div>
    </form>
    When i hit 'submit' i get the following error:

    A General Script Error Occurred

    --------------------------------------------------------------------------------
    Error: Could not locate the product reference.
    --------------------------------------------------------------------------------
    Press the Browser back button and try again or contact the site owner
    This page that is viewed is the following link:
    http://www.wheels.uk.com/cgi-bin/ca000002.pl

    Now it states the product reference cannot be located, does this mean I need to add this form in a product layout to get it to work?

    Could anyone help???
    Regards,
    BARRY HUGHES
    WHEELS UK - Website Designer / Marketing Director
    http://www.wheels.uk.com

    #2
    You can create a custom contact us form very easily, you could use the simple generator available here - http://www.tele-pro.co.uk/scripts/contact_form/

    Comment


      #3
      I have used my own which works fine on a normal html page, however within actinic i get the error i spoke about above.
      Any ideas why?
      Regards,
      BARRY HUGHES
      WHEELS UK - Website Designer / Marketing Director
      http://www.wheels.uk.com

      Comment


        #4
        I can't see an opening or closing tag for your form.

        Comment


          #5
          I think i see the problem, am just re-uploading the site now...

          HTML Code:
          <form method="post" action="[SendMailPageURL]">
          <input type="hidden" name="RANDOM" value="[Random]" />
          I havent changed the actions....oops! hopefully this will solve the problem!
          Regards,
          BARRY HUGHES
          WHEELS UK - Website Designer / Marketing Director
          http://www.wheels.uk.com

          Comment


            #6
            It's hard to say without seeing the ca000002.pl script but i would think if you have modified the original Actinic script it has some reference in there thats not in your form or maybe it's a refernece in the layout around the thanks-email.html or something.

            I've just tried the following and it seems to work no problem. (you might have just got the email)

            Insert the following code in to a fragment:

            Code:
            !!<<form method="POST" action="/cgi-bin/contact.pl">
            Fields marked (*) are required
            
            <p>Email From:* <input type="text" name="EmailFrom"></p>
            <input type="hidden" name="EmailTo" value="john@wheels.uk.com">
            <input type="hidden" name="Subject" value="Suspension Form Results">
            <p>Name: <input type="text" name="Name"></p>
            <p>carmake: <input type="text" name="carmake"></p>
            <p>car model: <input type="text" name="carmodel"></p>
            <p>year: <select name="year" size="1">
            	  	<option>Please Select</option>
                    <option value="1990">1990</option>
                    <option value="1991">1991</option>
                    <option value="1992">1992</option>
                    <option value="1993">1993</option>
                    <option value="1994">1994</option>
                    <option value="1995">1995</option>
                    <option value="1996">1996</option>
                    <option value="1997">1997</option>
                    <option value="1998">1998</option>
                    <option value="1999">1999</option>
                    <option value="2000">2000</option>
                    <option value="2001">2001</option>
                    <option value="2002">2002</option>
                    <option value="2003">2003</option>
                    <option value="2004">2004</option>
                    <option value="2005">2005</option>
                    <option value="2006">2006</option>
                    <option value="2007">2007</option>
                    <option value="2008">2008</option>
            </select></p>
            <p>comments: <textarea name="comments" cols="50" rows="10"></textarea></p>
            <p><input type="submit" name="submit" value="Submit"></p>
            </form>>!!
            Save the following code as contact.pl and upload to your cgi-bin

            Code:
            #!/usr/bin/perl
            use CGI::Carp qw(fatalsToBrowser);
            use CGI qw(:standard);
            print "Content-type: text/html \n\n";
            
            
            # get posted data into local variables
            $input = new CGI;
            $EmailFrom = $input->param('EmailFrom'); 
            $Name = $input->param('Name'); 
            $carmake = $input->param('carmake'); 
            $carmodel = $input->param('carmodel'); 
            $year = $input->param('year'); 
            $comments = $input->param('comments'); 
            
            # validation
            $validationOK=true;
            if ($EmailFrom eq '') {$validationOK=false;}
            if ($EmailTo eq '') {$validationOK=false;}
            if ($validationOK eq false) {
              print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
              exit;
            }
            
            # prepare email body text
            $Body .= "Name: ";
            $Body .= "$Name";
            $Body .= "\n";
            $Body .= "carmake: ";
            $Body .= "$carmake";
            $Body .= "\n";
            $Body .= "carmodel: ";
            $Body .= "$carmodel";
            $Body .= "\n";
            $Body .= "year: ";
            $Body .= "$year";
            $Body .= "\n";
            $Body .= "comments: ";
            $Body .= "$comments";
            $Body .= "\n";
            
            # send email 
            $mailprog = '/usr/sbin/sendmail -t';
            open(MAIL,"|$mailprog");
            print MAIL "To: john@wheels.uk.com";
            print MAIL "From: $EmailFrom\n";
            print MAIL "Subject: Suspension Form Results";
            print MAIL $Body;
            close(MAIL);
            
            # redirect to success page 
            print "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.wheels.uk.com/acatalog/thanks-email.html">";
            Obviously the form needs tidying up and formatting but the form and script work within Actinic.

            Comment


              #7
              Thanks for that, have just implmented it, however it now returns a HTTP 500 Error.

              http://www.wheels.uk.com/acatalog/suspension.html

              Will speak to Tech Support later, unless you know anymore possibilities?
              Regards,
              BARRY HUGHES
              WHEELS UK - Website Designer / Marketing Director
              http://www.wheels.uk.com

              Comment


                #8
                500 error normally means wrong permissions - it the script 755?

                Comment


                  #9
                  That's what I thought straight away, the permission is changed to 755, however it still returns the same 500 error.
                  Regards,
                  BARRY HUGHES
                  WHEELS UK - Website Designer / Marketing Director
                  http://www.wheels.uk.com

                  Comment


                    #10
                    I have managed to sort it using my own 'formmail.cgi' in the cgi-bin to process the action.
                    Finally, after taking hours searching through code and trying various different techniques.
                    Thanks for the help!
                    Regards,
                    BARRY HUGHES
                    WHEELS UK - Website Designer / Marketing Director
                    http://www.wheels.uk.com

                    Comment

                    Working...
                    X