Skip navigation
Currently Being Moderated

unable to click into next Text field

Aug 16, 2012 3:45 PM

Tags: #text #field

Hi,

I don't what I've done, haven't had this problem before but in my contact form I have the usual Text fields for name & address etc but when I view the page in a browser I can't click in the next field, it just hightlights the first field. The only way to move to the next field is to tab but I'm thinking some viewers on the site might not be able to figure that out.

Any suggestions? Thanks.

 
Replies
  • Currently Being Moderated
    Aug 16, 2012 4:18 PM   in reply to gofer

    Got a link so we can take a look in our browsers?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 16, 2012 5:14 PM   in reply to gofer

    Not really (to me anyway).

     

    These issues are easiest to troubleshoot when we can see them in our browsers.

     

    Perhaps someone else here wll come along with a solution.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 1:14 AM   in reply to gofer

    Whats in the form hander file:

     

    php-files/contact-form-handler.php

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 3:07 AM   in reply to gofer

    Humm......you may need to find another php form processing script.

     

    Your form should work if you remove the email validation part (see below - I can't see any reason to valid an email field (apart from it being empty) simply because anyone can put any email address in it or make simple spelling error when typing the email. HOWEVER although your form submits to your email address once this has been removed it doesnt appear to be pulling the other information from the php variables.

     

    if (!preg_match(

    "/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3} ) $/i",

    $email_address))

    {

    $errors .= "\n Error: Invalid email address";

    }

     

     

    If you do want to validate the email address then you should really try and find a form where the user gets asked to re-type their email address so there is less possibilty of a mistake....otherwise as I say I can't see any reason to try and validate a 'single' email field as the possibilities of errors or abuse is wide open.

     

    The form doesn't appear to validate any of the other fields if they are left empty........so it's a useless script in my opinion.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 4:23 AM   in reply to osgood_

    DING! DING! The light has just come one.

     

    I couldn't understand why no information was being sent from the form to the recipient email address until I took a look at the 'form' - you have no 'method' set so the form won't work.

     

    Set method="post" as below and you should be good to go:

     

    <form action="php-files/contact-form-handler.php" id="order" method="post">

     

     

    It looks like youre using a jquery script to validate the form, right? So you can remove the validate email field section of code I identified in the above post. Then you'll get some feedback through.

     

    <script>

    jQuery(function ($) {

        $('#order').validate();

    });

    </script>

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 11:48 PM   in reply to gofer

    You have to add the php $variables to the $email_body string (see below) where I've added '$phone' , '$address' , '$addresstwo' and '$wine'

     

     

    $email_body = "You have received a new message. ".

     

              " Here are the details:\n Name: $name \n Email: $email_address \n Phone: $phone \n Address: $address \n Address: $addresstwo \n Wine: $wine \n Message \n $message";

     

     

     

    Also the $address variable for two and three are incorrect in your form-handler php. They should be as below, not like address-two, address-three.

     

    $addresstwo = $_POST['addresstwo'];

     

    $addressthree = $_POST['addressthree'];

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 17, 2012 11:56 PM   in reply to osgood_

    Hopefully that should get you going......you just need to add the other php $variables that you want returned using the same formula. \n - which returns a new line - Address: which prefixes the variable field and the variable - $address - which gets the information from the 'address' form name.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 18, 2012 11:53 PM   in reply to gofer

    gofer wrote:

     

    Also (sorry) to send a conformation back to the viewer, would I use something like this with obvious changes to field names etc;

     

    $contact_msg="Dear $contact,

     

     

    Thank you for taking the time to contact This Constructions via our web site.

    Your request has been received and a member of our staff will contact you soon.

     

     

    Regards

    This Constructions

    -----------------------------------

    http://www.xxx.co.nz

    mailto:build@xxx.co.nz

    -----------------------------------

     

     

    ";

     

     

    mail("$email_address","Contact Form","$contact_msg","From: This Constructions commercial interior fitout specialist <info@xxx.co.nz>");

     

     

    $contact_copy="

     

     

    The below code (scroll down) creates a return email message that is automatically sent to the person on submission of the form. Change the $replyfrom ="From: build@xxx.co.nz to the email address you want the user to see and also do the same for $replymessage .="build@xxx.co.nz

     

    The code should be inserted into the form-hander php script directly after :

     

    $total= $_POST['total'];

     

    and before:

     

    if( empty($errors))

     

     

    Then add:

     

    mail($reply,$replysubject,$replymessage,$replyfrom);

     

    after:

     

    mail($to,$email_subject,$email_body,$headers);

     

     

    <!----------BELOW IS THE CODE WHICH GOES IN THE PHP SCRIPT ------->

     

    /* Creates strings for the automated reply email once the user submits the form */

        $reply = $_POST['email'];

        $replysubject = "Auto-Reply: From Hamdenestate Website";

        $replyfrom = "From:  build@xxx.co.nz\r\n";

        $replymessage = "".$_POST['name'].",\r\n\r\n";

        $replymessage .= "Thank you for taking the time to contact This Constructions via our web site.\r\n\r\n";

        $replymessage .= "Your request has been received and a member of our staff will contact you soon.\r\n\r\n\r\n\r\n";

        $replymessage .= "Regards,\r\n";

        $replymessage .= "This Construction\r\n";

        $replymessage .= "build@xxx.co.nz\r\n";

        $replymessage .= "http://www.hamdenestate.co.nz\r\n\r\n";

        $replymessage .= "This e-mail is automated, so please DO NOT reply.\r\n";

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 18, 2012 11:51 PM   in reply to gofer

    gofer wrote:

     

    Thank you osgood for your help, I've got the form retuning the type wine and qty but I can't figure out to get the total amount as in dollars.

    Trawled the net but find the answer I'm afraid, would you be able to point me in the right direction.

     

    I'm not sure about this one as it would require some javascript to multiply the 'bottle/cases quantity input boxes' by the price and then automatically insert the total sum in the 'total' box.

     

    I would create another post in the forum for this one saying what you require to happen. I'm sure it can be done.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points