Page 1 of 1

Request: Confirm Email Address

Posted: Thu Jan 17, 2008 4:21 am
by vinman57
A great job on this script. I would like to see the following feature on the ticket submission form:

Email address: ____________________

Re-enter (confirm) Email address: ________________

I have found that some people enter a wrong email address (inadvertantly). If they do that, there is no way we can contact them.
Having them re-enter their email address - and having the script validate that both emails match - increases the odds that the email is correct.

Thank you for considering this.

Posted: Thu Jan 17, 2008 9:13 am
by Klemen

Posted: Thu Jan 17, 2008 1:44 pm
by vinman57
perfect. Thanks

Integration with "Email Piping"

Posted: Thu Jan 31, 2008 11:21 am
by vforneris
Hi, if anyone needs to add this feature but he/she has already added the email piping (aka email2ticket) feat, just edit the file

process_email.php

adding the line

$_POST['email2'] = $email;

Cheers
Vega

Re:

Posted: Sun Feb 20, 2011 11:17 pm
by Raven
Hi, any chance of reposting a 'working' link to this mod and also confirming if it will work with v2.2?

Mucho thanko :)

Re: Request: Confirm Email Address

Posted: Mon Feb 21, 2011 1:31 pm
by Klemen
It's included by default in version 2.3

Now cross your finger that the beta will be out soon :wink:

Re: Request: Confirm Email Address

Posted: Mon Feb 21, 2011 2:12 pm
by Raven
Nice one :) Hopefully I will be able to just 'borrow' that bit to bolt in to v2.2 rather than spend days re doing my theme when it arrives ;)

Re: Request: Confirm Email Address

Posted: Thu Mar 10, 2011 10:28 pm
by fonz
Hey everyone,

Until Klemen gets this done, if you want a quick solution, you can use a bit of javascript. Let me walk you through what I have done for my client.

First, add the second email field to your form. On the index.php page, look for

Code: Select all

<form method="post" action="submit_ticket.php" name="form1" enctype="multipart/form-data">
A few lines below that you will find the email field. It looks like this

Code: Select all

<td style="text-align:right" width="150"><?php echo $hesklang['email']; ?>: <font class="important">*</font></td>
	<td width="80%"><input type="text" name="email" size="40" maxlength="50" value="<?php if (isset($_SESSION['c_email'])) {echo stripslashes(hesk_input($_SESSION['c_email']));} ?>" /></td>
Enter the following code, immediately below the closing </td>tag. This adds the new email field to your form.

Code: Select all

<td style="text-align:right" width="150"><?php echo $hesklang['email2']; ?>: <font class="important">*</font></td>
	  <td width="70%"><input name="email2" type="text" id="email2" onblur="VerifyDataIsIdentical('email','email2')" value="<?php if (isset($_SESSION['c_email2'])) {echo stripslashes(hesk_input($_SESSION['c_email2']));} ?>" size="40" maxlength="50" /></td>
Please note that the reason I have references to "hesklang['email2']" is you need to place an entry in your text.php file. I will give you those instruction later in this post. There is a bit more code than you need in that paste, is because I plan on implementing that into a new MM_ValidateForm later, and I did not want to redo everything.

Next, place this javascript below the table that contains these three entries, on the line immediately below the table closing tag "</table>".

Code: Select all

<script type="text/javascript">
var d1pastval = new String();
var d2pastval = new String();
function VerifyDataIsIdentical(d1,d2) {
var d1val = document.getElementById(d1).value;
var d2val = document.getElementById(d2).value;
if(d1val.length && 
   d2val.length && 
   (d1val != d2val) && 
   ( (d1val != d1pastval) || (d2val != d2pastval) )) {
// alert message is between quotes on the next line. You may change this to any message you want. //
      alert("E-mails must match");
      d1pastval = d1val;
      d2pastval = d2val;
      return false;
   }
return true;
}
</script>
This will only alert your user one time, immediately after they leave the second email field that the two do not match.

Next, open your language/en/text.php file and add the following

Code: Select all

$hesklang['email2']='Please confirm your E-mail';
You can add that anywhere in the file, but I added it at around line 130, just to keep data grouped together.

I hope this helps everyone. When I get the function MM_validateForm done, if Klemen does not object, I will post it here.

Re: Request: Confirm Email Address

Posted: Thu Mar 10, 2011 11:22 pm
by Raven
Hi, I never thought of just validating it using an in-page routine - I'd got it in my head that it would need to be totally tied in with the whole Hesk database etc.. Sometimes the solution is so easy it escapes me lol

Just thinking now that a quick visit to 'Dynamic Drive' will lead me to a decent email confirmation script that will do the job nicely (unless JavaScript is disabled of course so will need to degrade nicely).

;) Thanks for that :)

I look forward to your next post completing this great (and now so blatantly simple mod) :D

Re: Request: Confirm Email Address

Posted: Fri Mar 11, 2011 5:37 pm
by Klemen
Thanks for sharing!

Re: Request: Confirm Email Address

Posted: Fri Mar 11, 2011 9:51 pm
by fonz
Raven and Klemen, you are welcome.

I was wondering if something like this might work, too

Code: Select all

<?php if(isset($_REQUEST['email']) || isset($_REQUEST['email2']))?>

<?php if($_REQUEST['email'] != $_REQUEST['email2']){$errors[] = "Please correctly confirm your email address";} ?>

<?php if(isset($_REQUEST['email2'])){unset($_REQUEST['email2']);} ?>
I haven't had time to do any testing. I need to finish the helpdesk for my client. I am also working on integrating a live chat module if anyone is interested.

Re: Request: Confirm Email Address

Posted: Fri Mar 18, 2011 5:15 pm
by Raven
Agreed, it would be great to use the same type of error message you get when something else goes wrong as well as perform the email check.

Not getting too much PC time these days what with my 5 week old keeping me busy phew! If you manage to get this working with the Hesk error message as opposed to a javascript popup please share ;)

Re: Request: Confirm Email Address

Posted: Sun Mar 27, 2011 9:49 pm
by fonz
Hi Raven,

Sorry I haven't been around lately. The chat/live help addon has taken more time than I expected.

Wow, a baby...congratulations. Your life will never be the same. :lol: You will lose lots of sleep, stay up nights worrying, even be heart-broken from time to time, but it is the best experience of your entire lifetime.

I will share when I get everything done. I think I should post it to Klemen, privately, first.

Re: Request: Confirm Email Address

Posted: Mon Mar 28, 2011 7:42 pm
by Klemen
Feel free to share it with the public, it's your work :wink:

Re: Request: Confirm Email Address

Posted: Mon Mar 28, 2011 10:02 pm
by Raven
fonz wrote:Hi Raven,

Sorry I haven't been around lately. The chat/live help addon has taken more time than I expected.

Wow, a baby...congratulations. Your life will never be the same. :lol: You will lose lots of sleep, stay up nights worrying, even be heart-broken from time to time, but it is the best experience of your entire lifetime.

I will share when I get everything done. I think I should post it to Klemen, privately, first.
Hi and thank you for the congratulations :) She's doing really well and yup sleep is a thing of the past (as is working on my web site) lol

Cheers,

One chuffed Dad *HUGE SMILE*