Alert Value Not Populating Dialog Box - html

Making a JS/HTML validation form for my website. The form works great but I want to show an alert dialog box showing the users inputs before submitting successfully. I initialize var dataPreview to return if no errors occur, however upon pressing submit, it goes straight to the confirmation page. Any feedback is appreciated!
function validateForm(){
var name = document.contactForm.name.value;
var email = document.contactForm.email.value;
var mobile = document.contactForm.mobile.value;
var address = document.contactForm.address.value;
var birth = document.contactForm.birth.value;
var nameErr = emailErr = mobileErr = addressErr = birthErr = true;
if(name == "") {
printError("nameErr", "Please enter your name");
} else {
var regex = /^[a-zA-Z\s]+$/;
if(regex.test(name) === false) {
printError("nameErr", "Please enter a valid name");
} else {
printError("nameErr", "");
nameErr = false;
}
}
if(email == "") {
printError("emailErr", "Please enter your email address");
} else {
// Regular expression for basic email validation
var regex = /^\S+#\S+\.\S+$/;
if(regex.test(email) === false) {
printError("emailErr", "Please enter a valid email address");
} else{
printError("emailErr", "");
emailErr = false;
}
}
if(mobile == "") {
printError("mobileErr", "Please enter your mobile number");
} else {
var regex = /^[1-9]\d{9}$/;
if(regex.test(mobile) === false) {
printError("mobileErr", "Please enter a valid 10 digit mobile number");
} else{
printError("mobileErr", "");
mobileErr = false;
}
}
if(address == "") {
printError("addressErr", "Please enter your address");
} else {
var regex = /^[a-zA-Z\s]+$/;
if(regex.test(address) === false) {
printError("addresasErr", "Please enter a valid name");
} else {
printError("addressErr", "");
addressErr = false;
}
}
if(birth == "") {
printError("birthErr", "Please enter your birthday");
} else {
var regex = /^[a-zA-Z\s]+$/;
if(regex.test(birth) === false) {
printError("birthErr", "Please enter a valid birthday");
} else {
printError("birthErr", "");
birthErr = false;
}
}
***if((nameErr || emailErr || mobileErr || addressErr || birthErr) == true){
return false;
} else{
var dataPreview = "You have entered the following information: \n" +
"Full Name: " + name + "\n" +
"Email Address: " + email + "\n" +
"Mobile Number: " + mobile + "\n" +
"Address: " + address + "\n" +
"Birthday: " + birth + "\n";
alert(dataPreview);
}
}
</script>

Related

Google Apps Script to Update Google Drive Folder Sharing settings

I am trying to automate the process of updating sharing permissions of a google drive folder based on email addresses stored in a google sheets document.
Sheet named 'Sharing_Opt' has 2 columns, A and B.
Col A contains the addresses that should be viewers, and Col B dwellers should be editors.
If an email is present in both columns it should be counted as B thus editor.
If somebody has the folder shared with them who are not in this list of emails, they should have their access revoked.
There are also exceptions, that are always editor, and not touched by the code even if they are not found in the list.
If somebody has the wrong permission (ie.: they have editor permission, but are not found in either exceptions, or col B, they should be demoted to viewers, and vice versa).
There may also be blank cells containing nothing between emails, the script should skip those.
Also when run, it should log changes it did with the date into a log file for later inspection.
Also the code shouldn't touch people that are present in their 'rightful' place, so no remove everything and add again approach is preferred.
Also people who are shared a folder currently get emails that a folder has been shared with them, I want no emails, notifications, just run it in the background and that's it. All info I need should be in the log.
This is my code right now, it doesn't rly do what I need, and I'm completely stuck where it all went wrong.
I have 2 approaches, both of them work kinda, but are not perfect so I can't use any of them right now.
Code 1:
function updateAccess11() {
var folderId = "FOLDER_ID";
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getSheetByName("Sharing_Opt");
var viewEmails = sheet.getRange("A2:A").getValues().flat().filter(Boolean);
var editEmails = sheet.getRange("B2:B").getValues().flat().filter(Boolean);
var folder = DriveApp.getFolderById(folderId);
var viewers = folder.getViewers();
var editors = folder.getEditors();
var excludeEmails = ["excep1#gmail.com", "pleasehelpme#gmail.com", "iamtotallystuck#gmail.com"]; // List of emails to always exclude
var currentEmails = viewers.concat(editors).map(function(user) {
return user.getEmail();
});
var removeEmails = currentEmails.filter(function(email) {
return !excludeEmails.includes(email) && !viewEmails.includes(email) && !editEmails.includes(email);
});
Logger.log("new Viewers: " + viewEmails.filter(function(email) { return !currentEmails.includes(email); }));
Logger.log("new Editors: " + editEmails.filter(function(email) { return !currentEmails.includes(email); }));
Logger.log("remove Emails: " + removeEmails);
var dir = DriveApp.getFolderById("FOLDER_ID");
var logFileName = "AccessLog" + ".txt";
var logFile = DriveApp.getFileById("LOG_FILE_ID")
var logFileId = logFile.getId();
var logFile = DriveApp.getFileById(logFileId);
var log = "Log Results:\n\n" + "new Viewers: " + viewEmails.filter(function(email) { return !currentEmails.includes(email); }) + "\n\n" + "new Editors: " + editEmails.filter(function(email) { return !currentEmails.includes(email); }) + "\n\n" + "removed Emails: " + removeEmails;
var currentContent = logFile.getBlob().getDataAsString();
var date = new Date().toLocaleString();
var newContent = "--------" + date + "--------" + "\n\n" + log + "\n\n" + currentContent;
logFile.setContent(newContent);
removeEmails.forEach(function(email) {
var user = editors.find(function(editor) {
return editor.getEmail() === email;
});
if (user) {
folder.removeEditor(user);
} else {
user = viewers.find(function(viewer) {
return viewer.getEmail() === email;
});
if (user) {
folder.removeViewer(user);
}
}
});
viewEmails.filter(function(email) {
return currentEmails.includes(email);
}).forEach(function(email) {
folder.removeEditor(editors.find(function(editor) {
return editor.getEmail() === email;
}));
folder.removeViewer(viewers.find(function(viewer) {
return viewer.getEmail() === email;
}));
});
// Add emails to roles
viewEmails.filter(function(email) {
return !currentEmails.includes(email);
}).forEach(function(email) {
folder.addViewer(email);
});
editEmails.filter(function(email) {
return !currentEmails.includes(email) && !viewEmails.includes(email);
}).forEach(function(email) {
folder.addEditor(email);
});
// Remove emails from conflicting roles
viewEmails.filter(function(email) {
return currentEmails.includes(email) && editEmails.includes(email);
}).forEach(function(email) {
folder.removeEditor(editors.find(function(editor) {
return editor.getEmail() === email;
}));
});
viewEmails.filter(function(email) {
return !currentEmails.includes(email);
}).forEach(function(email) {
folder.addViewer(email);
});
editEmails.filter(function(email) {
return !currentEmails.includes(email);
}).forEach(function(email) {
folder.addEditor(email);
});
}
Code 2:
function updatePermissions() {
var sheet = SpreadsheetApp.getActiveSheet();
var sharingOptSheet = SpreadsheetApp.getActive().getSheetByName("Sharing_Opt");
var colA = sharingOptSheet.getRange("A2:A").getValues();
var colB = sharingOptSheet.getRange("B2:B").getValues();
var folder = DriveApp.getFolderById("FOLDER_ID");
var users = folder.getEditors().concat(folder.getViewers());
DriveApp.getRootFolder().removeNotificationEmails();
var emails = {};
for (var i = 0; i < colA.length; i++) {
if (colA[i][0]) {
emails[colA[i][0]] = "viewer";
}
}
for (var i = 0; i < colB.length; i++) {
if (colB[i][0]) {
emails[colB[i][0]] = "editor";
}
}
var exceptions = ["helpmeplease#gmail.com", "<3#gmail.com", "iamsoclose#gmail.com"];
var currentUserEmail = Session.getEffectiveUser().getEmail();
for (var email in emails) {
var role = emails[email];
if (!emails.hasOwnProperty(email)) continue;
if (email === currentUserEmail || exceptions.indexOf(email) !== -1) continue;
try {
if (role === "editor") {
folder.addEditor(email);
DriveApp.getFileById(folder.getId()).setSharing(DriveApp.Access.DOMAIN, DriveApp.Permission.NONE);
Logger.log(email + " was added as editor.");
} else {
folder.addViewer(email);
DriveApp.getFileById(folder.getId()).setSharing(DriveApp.Access.DOMAIN, DriveApp.Permission.NONE);
Logger.log(email + " was added as viewer.");
}
} catch (error) {
Logger.log("Error: " + error + " for email: " + email);
}
}
for (var i = 0; i < users.length; i++) {
var email = users[i].getEmail();
var role = emails[email] || "viewer";
if (!emails.hasOwnProperty(email) && exceptions.indexOf(email) === -1) {
folder.removeEditor(users[i]);
DriveApp.getFileById(folder.getId()).setSharing(DriveApp.Access.DOMAIN, DriveApp.Permission.NONE);
Logger.log(email + " was removed from the folder.");
} else if (role === "editor" && folder.getEditors().indexOf(users[i]) === -1) {
folder.addEditor(users[i]);
DriveApp.getFileById(folder.getId()).setSharing(DriveApp.Access.DOMAIN, DriveApp.Permission.NONE);
Logger.log(email + " was promoted to editor.");
} else if (role === "viewer" && folder.getEditors().indexOf(users[i]) !== -1) {
folder.removeEditor(users[i]);
DriveApp.getFileById(folder.getId()).setSharing(DriveApp.Access.DOMAIN, DriveApp.Permission.NONE);
Logger.log(email + " was demoted to viewer.");
} else {
Logger.log(email + " has the correct role of " + role + ".");
}
}
Logger.log("Exceptions: " + exceptions.join(", "));
}
thanks for you insight and help <3!

Extracting Google Meet URL from Google Calendar API [duplicate]

I want to create a line notify which can send the event detail from my google calendar everyday.
I can get the title, description, location...etc, but I don't see the conference data in calendar API.
I use Google Apps Script to run the code.
Here is my code.
const Now = new Date();
const Start = new Date(new Date().setHours(0, 0, 0, 0));
const End = new Date(new Date().setHours(23, 59, 59, 999));
const calendarData = calendar.getEvents(Start, End);
function Notify() {
var NotifyContents = '';
var i = 1;
calendarData.forEach(item =>{
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i+". "+ item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n": "";
NotifyContents += (item.getconferencedata() != "") ? ("\n" + i+". "+ item.getconferencedata()) : ("No Conference\n");
i++;
}
}
)
if (typeof NotifyContents === 'string' && NotifyContents.length === 0) {
return;
}
NotifyTokens.forEach(function(value){
UrlFetchApp.fetch("https://notify-api.line.me/api/notify", {
"method" : "post",
"payload" : {"message" : NotifyContents},
"headers" : {"Authorization" : "Bearer " + value}
});
});
}
Reference - Calendar API Link
In order to retrieve the meet link from the event, it seems that in the current stage, Calendar API is required to be used. When this is reflected in your script, how about the following modification?
Modified script:
Before you use this script, please enable Calendar API at Advanced Google services.
From:
var NotifyContents = '';
var i = 1;
calendarData.forEach(item => {
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i + ". " + item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n" : "";
NotifyContents += (item.getconferencedata() != "") ? ("\n" + i + ". " + item.getconferencedata()) : ("No Conference\n");
i++;
}
}
)
To:
const eventList = Calendar.Events.list(calendar.getId(), { timeMin: Start.toISOString(), timeMax: End.toISOString(), maxResults: 2500 }).items.reduce((o, e) => (o[e.id] = e.conferenceData.entryPoints.map(({ uri }) => uri).join(","), o), {});
var NotifyContents = '';
var i = 1;
calendarData.forEach(item => {
if (Now <= item.getStartTime()) {
NotifyContents += (item.getTitle() != "") ? ("\n" + i + ". " + item.getTitle() + "\n") : ("\n\nNo Title\n");
NotifyContents += (item.getDescription() != "") ? item.getDescription() + "\n" : "";
NotifyContents += (item.getStartTime() != "" && item.getEndTime() != "") ? "Time:" + item.getStartTime().toLocaleTimeString() + "-" + item.getEndTime().toLocaleTimeString() + "\n" : "";
var eventId = item.getId().split("#")[0];
NotifyContents += eventList[eventId] != "" ? ("\n" + i + ". " + eventList[eventId]) : ("No Conference\n");
i++;
}
});
In this modification, it supposes that calendar has already been declaread. Please be careful about this.
Reference:
Events: list

External Js file does not validate my html form

I did a code in html linked to an external Js file but it the JS code doesn't validate the form fields. Can anyone spot the problem please. I tried everything i could to get the JS to validate the form but it just wouldn't work. Below is the JS code:
<script>
function validateMyForm() {
var fname = document["myform"]["firstname"].value;
var lname = document["myform"]["lastname"].value;
var email = document["myform"]["email"].value;
var atpos = email.indexOf("#");
var dotpos = email.lastIndexOf(".");
var pass = document["myform"]["password"].value;
var passlen = pass.length;
var confpass = document["myform"]["ConfirmPassword"].value;
if (fname == null || fname == "") {
alert("Please enter your First Name!");
return false;
} else if (lname == null || lname == "") {
alert("Please enter a your Last Name!");
return false;
} else if (email == null || email == "") {
alert("Please enter an email!");
return false;
} else if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= email.length) {
alert("Please enter a valid email address!");
return false;
} else if (pass == null || pass == "") {
alert("Please enter a Password!");
return false;
} else if (passlen < 4 || passlen > 15) {
alert("Password needs to be to have a length of 4-15 characters");
return false;
} else if (pass != confpass) {
alert("Passwords do not match!");
return false;
}
}
</script>
Due to the fact that you did not post your HTML, I am going to assume that you are not triggering your function.
In order for your function to work you need to trigger the form validation function. In order to do this, you will need to add onsubmit="return validateMyForm()" to your form tag. Make sure to include return before calling your function. As shown here
If there are problems with your code you see the errors using the inspector that is built into all web browsers. If you are using chrome you can access the inspector by pressing Control+Shift+C

Centering image in Excel

I've been trying to center an image in an Excel export file using Classic ASP. I tried everything and resorted to CSS. CSS didn't work (examples below):
img {
position: absolute;
top: 0; bottom:0; left: 0; right:0;
margin: auto;
}
and
img.center {
display: block;
margin: 0 auto;
}
I tried putting the image in a div and centering the div. That also didn't work. I have the image in an img tag like this:
<img border=0 id= "img" name= "img" src="pic.jpg" height ="100" width= "1000">
When I export the file to Excel and open it, the picture is always to the very left.
While simple Excel files can be created through ASP Classic simply by setting the headers for the page, you will often need more control.
Please take a look at this: http://www.crydust.be/blog/2009/03/02/generate-excel-files-in-asp-classic/
Code repostedform Kristof Neirynck's blog here:
<%#LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<%
function getData(connectionString, sql){
var result = null;
var adStateOpen = 1;
var connection = new ActiveXObject("ADODB.CONNECTION");
try{
connection.Open(connectionString);
} catch(e1){
return null;
}
if (connection.State !== adStateOpen) {
return null;
}
try{
var recordset = connection.Execute(sql);
} catch(e2){
return null;
}
if (!recordset.EOF) {
result = recordset.GetRows().toArray();
recordset.Close();
}
recordset = null;
connection.Close();
connection = null;
return result;
}
function writeCsvHttpHeaders(filename){
Response.ContentType = "text/csv";
Response.Charset = "utf-8";
Response.AddHeader("Content-Disposition",
"attachment; filename="+filename+".csv");
}
function writeXlsHttpHeaders(filename){
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "utf-8";
Response.AddHeader("Content-Disposition",
"attachment; filename="+filename+".xls");
}
function getXlsStart(){
return ""
+ "<html>\n"
+ "<head>\n"
+ "<meta http-equiv=\"Content-Type\" "
+ "content=\"text/html; charset=UTF-8\">\n"
+ "<style type=\"text/css\">\n"
+ "html, body, table {\n"
+ " margin: 0;\n"
+ " padding: 0;\n"
+ " font-size: 11pt;\n"
+ "}\n"
+ "table, th, td { \n"
+ " border: 0.1pt solid #D0D7E5;\n"
+ " border-collapse: collapse;\n"
+ " border-spacing: 0;\n"
+ "}\n"
+ "</style>\n"
+ "</head>\n"
+ "<body>\n"
+ "<table>\n"
+ "";
}
function getXlsEnd(){
return ""
+ "</table>\n"
+ "</body>\n"
+ "</html>"
+ "";
}
function csvEscape(val){
if (typeof val === "number") {
return val.toString(10).replace(".", ",");
} else if (typeof val === "string") {
if (val.indexOf("\"") !== -1) {
return "\""+val.replace(/"/g, "\"\"")+"\"";
} else if (val.indexOf(";") !== -1) {
return "\""+val+"\"";
} else {
return val;
}
} else if (val === null) {
return "#NULL#";
} else if (val === undefined) {
return "#UNDEFINED#";
} else {
return "#ERROR#";
}
}
function writeCsv(filename, data, columnCount){
writeCsvHttpHeaders(filename);
// utf-8 BOM (very important for special characters)
Response.Write("\uFEFF");
for (var i=0, il=data.length; i<il; i+=columnCount) {
for (var j=0; j<columnCount; j++) {
Response.Write(csvEscape(data[i+j]));
if (j !== columnCount-1) {
Response.Write(";");
}
}
Response.Write("\n");
// prevent Response Buffering Limit Exceeded
if (i % 1000 === 0) {
Response.Flush();
}
}
}
function xlsEscape(val){
if (typeof val === "number") {
return val.toString(10).replace(".", ",");
} else if (typeof val === "string") {
return Server.HTMLEncode(val);
} else if (val === null) {
return "#NULL#";
} else if (val === undefined) {
return "#UNDEFINED#";
} else {
return "#ERROR#";
}
}
function writeXls(filename, data, columnCount){
writeXlsHttpHeaders(filename);
Response.Write(getXlsStart());
for (var i=0, il=data.length; i<il; i+=columnCount) {
Response.Write("<tr>");
for (var j=0; j<columnCount; j++) {
Response.Write("<td>");
Response.Write(xlsEscape(data[i+j]));
Response.Write("</td>");
}
Response.Write("</tr>\n");
// prevent Response Buffering Limit Exceeded
if (i % 1000 === 0) {
Response.Flush();
}
}
Response.Write(getXlsEnd());
}
function main(){
var filetype = Request.QueryString("filetype")();
Var connectionString = "Provider=SQLOLEDB.1;"
+ "Data Source=LAPTOP\\SQLEXPRESS;"
+ "User ID=internal;"
+ "Password=internal;"
+ "Initial Catalog=trees_in_sql";
Var sql = ""
+ "SELECT id \n"
+ ", name \n"
+ "FROM People \n"
+ ";";
var filename = "filename";
var columnCount = 2;
var data = getData(connectionString, sql);
if (data !== null) {
Response.Clear();
if (filetype === "csv") {
writeCsv(filename, data, columnCount);
} else {
writeXls(filename, data, columnCount);
}
} else {
Response.Write("Error, no data found");
}
Response.End();
}
main();
%>
.
IMPORTANT
Regarding images specifically, you should look at this: http://www.experts-exchange.com/Programming/Languages/Scripting/ASP/Q_27115638.html
From the above link:
<!--#include file="functions.asp"-->
<%
response.ContentType = "application/vnd.ms-excel"
thedate = CStr(Now())
groupid = request.querystring("groupid")
GroupName = getGroupName(groupid)
datetimestring = Replace(FormatDateTime(Now(), vbShortDate), "/", "-") & "_" & Replace(FormatDateTime(Now(), vbShortTime), ":", "")
response.AddHeader "Content-Disposition", "attachment;filename=GroupAttendanceExport_" & GroupName & "_" & datetimestring & ".xls"
response.write "<html><body><table>"
response.write "<tr><td><img border=0 src='https://www.example.org/xxx_Logo_small.jpg'></td></tr>"
response.write "<tr><td></td></tr>"
response.write "<tr><td></td></tr>"
response.write "<tr><td></td></tr>"
response.write "<tr><td></td></tr>"
response.write "<tr><td></td></tr>"
response.write "<tr><td > Attendance</td></tr>"
response.write "</table>"
MORE CODE HERE
………
………
………
………
response.write "</body></html>"
.
UPDATE
It sounds like you need to use OpenXML instead of HTML.
Here is an example of how to insert an image into a specific cell using OpenXML: https://social.msdn.microsoft.com/Forums/office/en-US/157e2fab-ed30-43a5-9824-e144d673a5b7/insert-images-into-specific-excel-cells-using-openxml?forum=oxmlsdk

Check for e-mail values before submitting

Before submitting the form I need a function to check for # and . symbols.
Function responsible for checking that values are inserted:
// function ValidateAndSend
function ValidateAndSend (event:MouseEvent):void {
// validate fields
if(!name_txt.length) {
status_txt.text = "Please enter your name";
} else if (!email_txt.length) {
status_txt.text = "Please enter your e-mail address";
} else if (!phone_txt.length) {
status_txt.text = "Please enter your phone number";
} else {
// All is good, send the data now to PHP
// ready the variables in our form for sending
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userPhone = phone_txt.text;
variables.userShop = shopList.value;
// Send the data to PHP now
varLoader.load(varSend);
} // close else condition for error handling
} // close validate and send function
I've tried creating a separate function for checking the e-mail symbols:
// Checking e-mail
function checkEmail():Boolean {
var reEmail:String = email_txt.text;
var emailOk:Boolean = false;
var checkArray1:Array = reEmail.split("#");
if (checkArray1.length >1) {
var checkArray2:Array = checkArray1[1].split(".");
if (checkArray2.length >1) {
emailOk = true;
}
}
return emailOk;
}
but this doesn't work. How would you achieve this?
Update: I've tried running the function inside ValidateAndSend function. But now if the email address is wrong it won't send the message but it still displays a successful submitting message.
// function ValidateAndSend
function ValidateAndSend (event:MouseEvent):void {
// validate fields
if(!name_txt.length) {
status_txt.text = "Please enter your name";
} else if (!email_txt.length) {
status_txt.text = "Please enter your e-mail";
// Checking e-mail
function checkEmail():Boolean {
var reEmail:String = email_txt.text;
var emailOk:Boolean = false;
var checkArray1:Array = reEmail.split("#");
if (checkArray1.length >1) {
status_txt.text = "Please check your e-mail address";
var checkArray2:Array = checkArray1[1].split(".");
if (checkArray2.length >1) {
emailOk = true;
}
}
return emailOk;
}
} else if (!phone_txt.length) {
status_txt.text = "Please enter your phone number";
} else {
// All is good, send the data now to PHP
// ready the variables in our form for sending
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userPhone = phone_txt.text;
variables.userShop = shopList.value;
// Send the data to PHP now
varLoader.load(varSend);
} // close else condition for error handling
} // close validate and send function
You should use regular expressions for this.
Your checkEmail() function won't be needed
// function ValidateAndSend
function ValidateAndSend (event:MouseEvent):void {
var emailCheckRegExp:RegExp = /^[\w.-]+#\w[\w.-]+\.[\w.-]*[a-z][a-z]$/i;
// validate fields
if(name_txt.length == 0) {
status_txt.text = "Please enter your name";
}
else if (email_txt.length == 0) {
status_txt.text = "Please enter your e-mail address";
}
else if (phone_txt.length == 0) {
status_txt.text = "Please enter your phone number";
}
else if(emailCheckRegExp.exec(email_txt.text) == null)
{
status_txt.text = "Entered e-mail is not valid";
}
else {
// All is good, send the data now to PHP
// ready the variables in our form for sending
variables.userName = name_txt.text;
variables.userEmail = email_txt.text;
variables.userPhone = phone_txt.text;
variables.userShop = shopList.value;
// Send the data to PHP now
varLoader.load(varSend);
} // close else condition for error handling
} // close validate and send function