Community Forums

[How-To] Contact Form - Confirm Email Field Added

Free manual modifications can be contributed here. Modifications are manual snippets of code that are pasted into the forums for others to use.

[How-To] Contact Form - Confirm Email Field Added

Postby aaron1988 » Fri Aug 12, 2011 9:08 pm

Hi everyone i thought i would post that i have added a new field called Confirm Email so if they put an email in Email field but they put the wrong email in confirm email it will say something like "Doesnt Match" i am using Jquery for this :).

EDIT: OOPS forgot to add attachments :) so here they are at bottomof post

Also i have only tested this on OC 1.5.1.1 but i believe should work on all the 1.5 releases or even below but it hasnt been tested so you could download something called Winmerge and compare the files to see if matches or what changes need to be made.

So here we go :)

Step 1: EDIT: catalog/controller/information/contact.php

Find:
Code: Select all
$this->data['entry_email'] = $this->language->get('entry_email');
then

Add After:
Code: Select all
$this->data['entry_confirm_email'] = $this->language->get('entry_confirm_email');


Then find:
Code: Select all
if (isset($this->error['email'])) {
         $this->data['error_email'] = $this->error['email'];
      } else {
         $this->data['error_email'] = '';
      } 


Add After:
Code: Select all
if (isset($this->error['confirm_email'])) {
         $this->data['error_confirm_email'] = $this->error['confirm_email'];
      } else {
         $this->data['error_confirm_email'] = '';
      } 


Find:
Code: Select all
if (isset($this->request->post['email'])) {
         $this->data['email'] = $this->request->post['email'];
      } else {
         $this->data['email'] = '';
      }


Add After:
Code: Select all
if (isset($this->request->post['confirm_email'])) {
         $this->data['confirm_email'] = $this->request->post['confirm_email'];
      } else {
         $this->data['confirm_email'] = '';
      }


Find:
Code: Select all
if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['email'])) {
            $this->error['email'] = $this->language->get('error_email');
       }


Add After:
Code: Select all
if (!preg_match('/^[^\@]+@.*\.[a-z]{2,6}$/i', $this->request->post['confirm_email'])) {
            $this->error['confirm_email'] = $this->language->get('error_confirm_email');
       }
       if ($this->request->post['confirm_email']!=$this->request->post['email']) {
            $this->error['confirm_email'] = $this->language->get('error_format_confirm_email');
       }


Now Edit: catalog/language/english/information/contact.php

Find:
Code: Select all
$_['text_email']     = 'E-Mail:';


Add After: $_['text_confirm_email'] = 'Confirm E-Mail:';

Find:
Code: Select all
$_['entry_email']    = 'E-Mail Address:<span class="required">*</span>';


Add After:
Code: Select all
$_['entry_confirm_email']    = 'Confirm E-Mail Address:<span class="required">*</span>';


Find:
Code: Select all
$_['error_email']    = 'E-Mail Address not in valid format!';


Add After:
Code: Select all
$_['error_confirm_email'] = 'E-mail Address not in valid format!';
$_['error_format_confirm_email'] = 'E-mail Address does not match!';


Edit: catalog/view/theme/default/template/information/contact.tpl

Find:
Code: Select all
<b><?php echo $entry_email; ?></b><br />


Replace with:
Code: Select all
<label for="email"><?php echo $entry_email; ?></label><br />


Find:
Code: Select all
<input name="email" type="text" value="<?php echo $email; ?>" />
add id to it so looks like:
Code: Select all
<input id="email" name="email" type="text" value="<?php echo $email; ?>" />


Add After:
Code: Select all
<span id="emailInfo">Valid E-mail please, you will need it to progress</span>


Find:
Code: Select all
<?php if ($error_email) { ?>
    <span class="error"><?php echo $error_email; ?></span>
    <?php } ?>
    <br />


Add After:
Code: Select all
<label for="confirm_email"><?php echo $entry_confirm_email; ?></label><br />
    <input id="confirm_email" name="confirm_email" type="text" value="<?php echo $confirm_email; ?>" />
    <span id="confirm_emailInfo">Confirm Email Address</span>
    <br />
    <?php if ($error_confirm_email) { ?>
    <span class="error"><?php echo $error_confirm_email; ?></span>
    <?php } ?>


Find:
Code: Select all
<?php echo $content_bottom; ?></div>


Add After:
Code: Select all
<script type="text/javascript" src="catalog/view/javascript/jquery.js"></script>   
<script type="text/javascript" src="catalog/view/javascript/validation.js"></script>


Please find attached the two .js files and upload them to catalog/view/javascript/ also the file validation.js as all the information into it to add all the the same sort of styles for Name, Enquiry and even adding Subject and Phone. all you do is repeat the above steps but change to subject or phone etc. If you want me to post a full tutorial on adding all these please ask :)

If this doesn't work for you please let me know :)

EDIT: i will also try and post a VQmod of this so its easier and quicker for people just need to get used to it first lol


jquery.js
(54.47 KiB) Downloaded 106 times

validation.js
(3.62 KiB) Downloaded 107 times


Kind Regards,
Aaron
aaron1988
 
Posts: 256
Joined: Thu Jan 27, 2011 2:03 am

Re: [How-To] Contact Form - Confirm Email Field Added

Postby Jeremy Fisk » Fri Oct 14, 2011 7:25 am

Heia Aaron,

Thanks for the great post...

I have had a go at puting it into a vqmod, but please check this out... it isn't working for some reason... i'm pretty new to vQmod so i have probabily stuffed it up... but have a look anyway...

Thanks Dude

O0 O0

Jem
Attachments
Email Validation.xml
Please don't anyone else use this vQmod untill it is checked out.
(5.25 KiB) Downloaded 74 times
User avatar
Jeremy Fisk
 
Posts: 924
Joined: Thu Nov 11, 2010 10:11 am
Location: New Zealand (Masterton, Wairarapa)

Re: [How-To] Contact Form - Confirm Email Field Added

Postby uksitebuilder » Fri Oct 14, 2011 2:27 pm

Test my vqmod Generator out if you want

http://1513.designs.org.uk/vqgen/vqgen.php
User avatar
uksitebuilder
 
Posts: 5602
Joined: Thu Jun 09, 2011 3:37 pm
Location: United Kindgom

Re: [How-To] Contact Form - Confirm Email Field Added

Postby aaron1988 » Sat Oct 15, 2011 8:19 am

Hi Jem,

Try Simons vQmod Generator :).

and if that doesnt work then i will take a further look :).

Kind Regards,
Aaron
aaron1988
 
Posts: 256
Joined: Thu Jan 27, 2011 2:03 am

Re: [How-To] Contact Form - Confirm Email Field Added

Postby Jeremy Fisk » Sat Oct 15, 2011 9:13 am

Hiya Aaron...

Thanks for your reply
Try Simons vQmod Generator :).
I have... see attached

Please note that i am trying on 1.5.0.2 and 1.4.9.5

Good luck

Jemz
Attachments
Email.xml
Email validation vQmod
(4.62 KiB) Downloaded 68 times
User avatar
Jeremy Fisk
 
Posts: 924
Joined: Thu Nov 11, 2010 10:11 am
Location: New Zealand (Masterton, Wairarapa)

Re: [How-To] Contact Form - Confirm Email Field Added

Postby spirit » Wed Nov 23, 2011 2:42 am

It didn't work for me in 1.5.1.3 :/
Any help?
spirit
 
Posts: 296
Joined: Fri Oct 01, 2010 11:40 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby aaron1988 » Thu Nov 24, 2011 9:11 pm

Hi ok :) i will look in the next few days when not at work lol

Thanks
Aaron
aaron1988
 
Posts: 256
Joined: Thu Jan 27, 2011 2:03 am

Re: [How-To] Contact Form - Confirm Email Field Added

Postby spirit » Thu Nov 24, 2011 10:15 pm

aaron1988 wrote:Hi ok :) i will look in the next few days when not at work lol

Thanks
Aaron

Thanks man!
I think that OC team need add this function officially because is very very useful :)
spirit
 
Posts: 296
Joined: Fri Oct 01, 2010 11:40 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby spirit » Tue Nov 29, 2011 12:41 am

Don't forget it :)
spirit
 
Posts: 296
Joined: Fri Oct 01, 2010 11:40 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby spirit » Mon Dec 12, 2011 11:29 am

Somebody can help in this way?
It's very useful, no doubt :)
spirit
 
Posts: 296
Joined: Fri Oct 01, 2010 11:40 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby remcofaasse » Tue Jan 10, 2012 4:11 pm

Hi,
I'm also interested in vqmod for v 1.5.1.3.
Is this available? Thanks for the reply. Kind regards, Remco
remcofaasse
 
Posts: 48
Joined: Sun Dec 04, 2011 6:20 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby Klimskady » Thu Jan 26, 2012 12:49 pm

Another vote for this for 1.5.1.3 as I have tried another similar to this but it didn't work so this would be great if it did..
Klimskady
 
Posts: 160
Joined: Mon Jun 06, 2011 11:57 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby khalilm » Tue Feb 07, 2012 12:51 am

Hi Everyone,

I saw the requests to have this functionality in 1.5.1.3 and thought it was a good idea so I added it to my code and would like to share with the community.

However, I have added it to Simon's "Better Contact Form" (BCF) which I believe is a must have to prevent spamming. You can find his code here:

http://forum.opencart.com/viewtopic.php?f=131&t=35286

I have been using BCF (2.0 with editable inputs) for a while, so I don't know if I have the latest version, but I have clearly marked my modifications in the code so if needed the changes could be copied.

If you find any errors, please post here and I will fix them. I will pass my changes along to Simon to see if he can add it in his code.

Hope this helps,
Khalil
Attachments
uksb_better_contact_form_no_name.xml
"Better Contact Form" with confirm email
(17.69 KiB) Downloaded 71 times
khalilm
 
Posts: 2
Joined: Sat Sep 17, 2011 5:32 pm

Re: [How-To] Contact Form - Confirm Email Field Added

Postby matte2k » Sat Mar 03, 2012 7:44 pm

Does this fix work with 1.4.9.5 ?
matte2k
 
Posts: 119
Joined: Thu Mar 01, 2012 11:07 am


Return to Modifications

Who is online

Users browsing this forum: No registered users and 12 guests

Hosted by Arvixe Web Hosting