18 Replies Latest reply: Aug 19, 2012 12:14 AM by gofer RSS

    unable to click into next Text field

    gofer Community Member

      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.

        • 1. Re: unable to click into next Text field
          John Waller MVP

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

          • 2. Re: unable to click into next Text field
            gofer Community Member

            Sorry John, only local at the moment. The form is linked to a jQuery file for calculating totals if that makes any difference?

             

            Cheers

            • 3. Re: unable to click into next Text field
              John Waller MVP

              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.

              • 4. Re: unable to click into next Text field
                gofer Community Member

                Thanks anyway John

                • 5. Re: unable to click into next Text field
                  gofer Community Member

                  Hi,

                  I've got the site up for testing, please go here: http://www.hamdenestate.co.nz/test-site/contact-us.html

                  Thank you

                  • 6. Re: unable to click into next Text field
                    gofer Community Member

                    Any ideas why I'm getting this message: "Error: Invalid email address" when I test the contact form, it goes to a PHP form handler.

                    Cheers

                    • 7. Re: unable to click into next Text field
                      gofer Community Member

                      Hold fire !! The problem of not being able to click in another field seems to have corrected it self, I don't know what I did?

                      But still got the form handler problem if someone can shead some light on it.

                      Cheers

                      • 8. Re: unable to click into next Text field
                        osgood_ MVP

                        Whats in the form hander file:

                         

                        php-files/contact-form-handler.php

                        • 9. Re: unable to click into next Text field
                          gofer Community Member

                          Thanks for the reply, this the php file;

                          <?php

                          $errors = '';

                          $myemail = 'sales@tridentsolutions.co.nz'; //<-----Put Your email address here.

                          if(empty($_POST['name'])  ||

                             empty($_POST['email']) ||

                             empty($_POST['message']))

                          {

                            

                          }

                           

                           

                          $name = $_POST['name']; 

                          $address = $_POST['address'];

                          $email_address = $_POST['email'];

                          $address = $_POST['address-two'];

                          $address = $_POST['address-three'];

                          $message = $_POST['message'];

                          $wine = $_POST['wine'];

                          $chardonnay2011bottles = $_POST['chardonnay2011bottles'];

                           

                           

                          $chardonnay2011cases = $_POST['chardonnay2011cases'];

                          $chardonnay2011total = $_POST['chardonnay2011total'];

                          $wine = $_POST['wine'];

                           

                           

                           

                           

                          $pinogris2011bottles = $_POST['pinogris2011bottles'];

                          $pinogris2011cases = $_POST['pinogris2011cases'];

                          $pinogris2011total = $_POST['pinogris2011total'];

                          $wine = $_POST['wine'];

                          $sauvignonblanc2011bottles = $_POST['sauvignonblanc2011bottles'];

                          $sauvignonblanc2011cases = $_POST['sauvignonblanc2011cases'];

                          $sauvignonblanc2011total = $_POST['sauvignonblanc2011total'];

                          $wine = $_POST['wine'];

                          $reisling2010bottles = $_POST['reisling2010bottles'];

                          $reisling2010cases = $_POST['reisling2010cases'];

                          $reisling2010total = $_POST['reisling2010total'];

                          $wine= $_POST['wine'];

                          $pinotnoir2009bottles = $_POST['pinotnoir2009bottles'];

                          $pinotnoir2009cases = $_POST['pinotnoir2009cases'];

                          $pinotnoir2009total = $_POST['pinotnoir2009total'];

                          $mixedcase= $_POST['mixedcase'];

                          $northislandfreight = $_POST['northislandfreight'];

                          $southislandfreight = $_POST['southislandfreight'];

                          $total= $_POST['total'];

                           

                           

                           

                           

                           

                           

                           

                           

                           

                           

                           

                           

                          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( empty($errors))

                          {

                                    $to = $myemail;

                                    $email_subject = "Contact form submission: $name";

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

                                    " Here are the details:\n Name: $name \n Email: $email_address \n Message \n $message";

                           

                                    $headers = "From: $myemail\n";

                                    $headers .= "Reply-To: $email_address";

                           

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

                                    //redirect to the 'thank you' page

                                    header('Location: contact-form-thank-you.html');

                          }

                          ?>

                          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

                          <html>

                          <head>

                                    <title>Contact form handler</title>

                          </head>

                           

                           

                          <body>

                          <!-- This page is displayed only if there is some error -->

                          <?php

                          echo nl2br($errors);

                          ?>

                           

                           

                           

                           

                          </body>

                          </html>

                          • 10. Re: unable to click into next Text field
                            osgood_ MVP

                            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.

                            • 11. Re: unable to click into next Text field
                              osgood_ MVP

                              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>

                              • 12. Re: unable to click into next Text field
                                gofer Community Member

                                Thank you osgood, that got the form returning to my mail box, great, but can't seem to extract any of the wine order details.

                                Could I test your patience and have a look at the form handler for me please.

                                As you can see from the html page, visitors can select from five selections of wine either by the bottle or the case.

                                Would appreciate your expert eye, thanks.

                                • 13. Re: unable to click into next Text field
                                  osgood_ MVP

                                  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'];

                                  • 14. Re: unable to click into next Text field
                                    osgood_ MVP

                                    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.

                                    • 15. Re: unable to click into next Text field
                                      gofer Community Member

                                      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.

                                      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="

                                       

                                      • 16. Re: unable to click into next Text field
                                        osgood_ MVP

                                        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";

                                        • 17. Re: unable to click into next Text field
                                          osgood_ MVP

                                          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.

                                          • 18. Re: unable to click into next Text field
                                            gofer Community Member

                                            Thank you again osgood, I'll do as you suggest and try the forum the total sum.

                                            All the best.