Tutorial: Email confirmation

In this tutorial we will see how to create a registration confirmation form for scheduling courses.


1. Create an application Control type


2. Click to add new fields.


3. We will add 9 fields according to the picture below


4. Go to the “Javascript” menu, where we will create validation events for our form.


5. Select the field “news” and the event “onClick” and then click on “edit”.


6. We will use the code below to Check or Uncheck the checkboxes of the field “opt_languages” according to what is selected in the “news”.

news – onClick

if(document.F1.news[1].checked)
{
for (i=0;i<document.F1.elements.length;i++)
{
if(document.F1.elements[i].type == "checkbox")
{ 
document.F1.elements[i].checked=false;
document.F1.elements[i].disabled = true;
}
}
} else {
 
for (i=0;i<document.F1.elements.length;i++)
{
if(document.F1.elements[i].type == "checkbox")
{
document.F1.elements[i].checked=1; 
document.F1.elements[i].disabled = false;
}
}
}

7. We will create also a code in the Form, OnSubmit event.


Form – onSubmit

if(document.F1.course.selectedIndex == 0) {
alert('Select a course');
return false;
}

8. Now access the event onValidate of the application.


9. Use the code below

news – onClick

$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Registration Confirmed </font></b>"; 
$msg .= "<br>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> {nome} </font></b>";
$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Personal Data:</font></b>";
$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'>Email: {email}<font></b>";
$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'>Best Time: {best_time} <font></b>";
$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'>Options: {opt_lingagues} <font></b>"; 
$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'>Message: {text}<font></b>";
$msg .= "</p>"; 
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";
 
sc_mail_send("www.netmake.com.br", "", "", "no-reply@netmake.com.br", {email}, "Scriptcase - Samples", 
$msg, "H", "" , "", "", "N", "");
 
//sc_mail_send("localhost", "", "", {email_from}, {email_to}, {subject}, $message, "H");
 
if ({sc_mail_ok}) {
 
echo "<script>alert('Message sent successfully! Will receive a confirmation email');</script>";

sc_redir(mcr15.php);
 
} else { 
sc_error_message("There was a problem in sending! Please contact the System 
Administrator through telephone (xx) xxxx-xxxx.");
}

10. Run the application

Tutorials in the same category

How to Send an e-mail with attachment

On this tutorial, Send an e-mail with attachment. 1. Create a new control form application 2...

How to send an E-mail using the macro sc_mail_send

On this tutorial, Send an email using the macro sc_mail_send. 1. Create a new control form applicat...

Authentication with Social Media

In this tutorial we will see how to create a control to perform authentication only with Social Netw...

Comment this post