I have a bootstrap modal where the users fill out a form and upon clicking submit, it opens the user's mail client using a mailto link and populates a new message.
I would like the modal to close when this happens, but when I add code to close the modal, the mailto link no longer works (mail client window does not open). The modal successfully closes. Any suggestions?
$('#request-form').submit(function (evt) {
if ($("#request-form").valid())
{
evt.preventDefault();
var firstName = $("#FirstName").val();
var lastName = $("#LastName").val();
var company = $("#Firm").val();
var address = $("#Address").val();
var city = $("#City").val();
var state = $("#State").val();
var zip = $("#Zip").val();
var phone = $("#Phone").val();
var email = $("#EmailAddress").val();
var product = $("#ProductName").val();
//Send email using mailto link
var body = "Send this email <removed>.%0D%0A%0D%0AFirst Name: " + firstName + "%0D%0ALast Name: " + lastName + "%0D%0ACompany: " + company +
"%0D%0AAddress: " + address + "%0D%0ACity: " + city + "%0D%0AState: " + state + "%0D%0AZip: " + zip + "%0D%0APhone: " + phone + "%0D%0AEmail: " + email +
"%0D%0AProduct: " + product;
var subject = "Product Request";
var recipient = $("#Recipient").val();
window.location.href = "mailto:" + recipient + "?subject=" + subject + "&body=" + body;
$("#questions-modal").modal('hide');
}
});
cshtml:
<button type="submit" class="btn btn-nav pull-right" id="btn-openMail" data-dismiss="modal">Submit</button>
You could try with "toggle"...
$("#questions-modal").modal('toggle');
or put some extra code.
Did you check console logs?
Related
whenever the user clicks my shred link they Automatically Redirect to the home page of my site I want they will go to custom URL(current session when URL is created) please help
a = prompt("Please Enter Your Name");
document.write(a);
function sendWhatsapp() {
var url1 = "www.createwishes.ml/?nam=" + a;
var sMsg = encodeURIComponent("Special Happy Navratri MSG For You From: " + a + " Create Your Special Message " + url);
var whatsapp_url = "whatsapp://send?text=" + sMsg;
window.location.href = whatsapp_url;
}
I think this does what you need, replace the alert with your redirection.
function sendWhatsapp() {
var a = prompt("Please Enter Your Name");
var url1 = "www.createwishes.ml/?nam=" + a;
var sMsg = encodeURIComponent( "Special Happy Navratri MSG For You From: " + a + " Create Your Special Message " + url1 );
var whatsapp_url = "whatsapp://send?text=" + sMsg;
console.log(whatsapp_url);
alert(whatsapp_url);
}
Click
I'm looking some way to bold text in email and when I open the msgBox.
I want bold only headlines, like in picture below:
this is my script, you choose some cell in row that interests you and run the function. Function show information about data from every cell in row, like inforamtion about "Name" and "email". Then if you push send it will send email with this informations. I want bold headlines for better clarity.
function sendEmail(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var fr1 = ss.getSheetByName("Sheet1");
var cell = ss.getActiveCell().getRow();
var lastColumn = fr1.getLastColumn();
var lastRowValues = fr1.getRange(cell,1,1,lastColumn).getValues();
var Nr = lastRowValues[0][0];
var Data = lastRowValues[0][1];
var Information = lastRowValues[0][2];
var Name = lastRowValues[0][3];
var email = lastRowValues[0][4];
var urlOfSS = ss.getUrl();
var message = "Message" +
"\n " +
"\nNr: " + Nr +
"\nData: " + Data +
"\nInformation: " + Information +
"\nName " + Name +
"\nEmail: " + email +
"\n " +
"\n Link to spreadsheet:" +
"\n " + urlOfSS;
var emails = ss.getSheetByName("Sheet1");
var numRows = emails.getLastRow();
var emailTo = email;
var subject = "Zgłoszenie FAS - " + Nr;
if (email == ""){
Browser.msgBox('This row is empty - Choose another');
} else {
var ui = SpreadsheetApp.getUi();
var l = ss.getSheets()[0]
var response = ui.alert('Email', "Do you want email \nNr: " + l.getRange(cell, 1).getValue() + "\nData: " + l.getRange(cell, 2).getValue() + "\nInforamtion: " + l.getRange(cell, 3).getValue()
+ "\nName: " + l.getRange(cell, 4).getValue(), ui.ButtonSet.YES_NO);
if (response == ui.Button.YES) {
GmailApp.sendEmail(emailTo, subject, message);
} else {
Logger.log('The user clicked "No" or the dialog\'s close button.');
}
}
}
Regards
If I understand the requirement, Only the side headers(underlined in the screenshot) needs decoration.
While going through the Google Apps Scripts - Documentation, I came through this.
Hope this helps you.
Using the HtmlServices & HtmlOutputFromFile() would fulfill your requirement.
Please refer to Custom Dialogs. This would help you
https://developers.google.com/apps-script/guides/dialogs
I just created a new Google form and want an automatic confirmation email to go out when the form is submitted. Essentially, an academic department uses the form to approve or deny transfer credit for a student, and then the automatic email confirmation goes to the student, so that he/she knows the decision without having to contact the student separately.
I did this before with 2 different forms about 5 months ago and never had a problem. But with this new form that I just created, the emails are not working. It appeared to be working yesterday, but I can't recreate the successful email confirmation today. I've looked through the message boards, but haven't found the same exact issue.
I'm using the script editor and creating a trigger "on form submit." I started with the code that I know works for my other form and just changed the values and the message. My script looks like this:
function myFunction(e) {
var UserName = e.values[1];
var LastName = e.values[2];
var FirstName = e.values[3];
var SAGEID = e.values[4];
var UserEmail = e.values[5];
var Dept = e.values[6];
var Coll1 = e.values[11];
var Course1 = e.values[12];
var Req1 = e.values[13];
var Decision1 = e.values[14];
var Coll2 = e.values[15];
var Course2 = e.values[16];
var Req2 = e.values[17];
var Decision2 = e.values[18];
var Coll3 = e.values[19]
var Course3 = e.values[20];
var Req3 = e.values[21];
var Decision3 = e.values[22];
var Coll4 = e.values[23];
var Course4 = e.values[24];
var Req4 = e.values[25];
var Decision4 = e.values[26];
var Notes = e.values[9];
var Subject = "Course Equivalency Request Decision - " + FirstName + " " + LastName + " (" + Dept + ")";
var Message = "The " + Dept + " department has made a decision regarding your course equivalency request. Any questions regarding the decision below should be directed to the " + Dept + " department. " +
"\n\n\nDepartment Comments: " + Notes +
"\n\nCourse 1: " + Coll1 + ": " + Course1 + "\nDecision: " + Decision1 + "\nRequirement: " + Req1 +
"\n\nCourse 2: " + Coll2 + ": " + Course2 + "\nDecision: " + Decision2 +
"\nRequirement: " + Req2 +
"\n\nCourse 3: " + Coll3 + ": " + Course3 + "\nDecision: " + Decision3 +
"\nRequirement: " + Req3 +
"\n\nCourse 4: " + Coll4 + ": " + Course4 + "\nDecision: " + Decision4 +
"\nRequirement: " + Req4 +
"\n\n\nPlease allow 3-4 business days for processing. If after 3-4 business days, your undergraduate degree audit does not reflect these substitutions, please contact the Office of the University Registrar at registrar#brandeis.edu or 781-736-2010." +
MailApp.sendEmail(UserEmail, Subject, Message);
}
I'm banging my head against the wall trying to figure out why a version of this script works perfectly well with a different form, but won't work for me now. I'm relatively new to writing Google scripts, so any help you can offer would be greatly appreciated.
I have a function that will be processing the checkout for an order on my website. Right now I haven't added in any of the ajax and what not but I'm trying to make a type of "loading screen" using javascript and bootstraps modal. This is what I have:
Javascript
function printCheckout() {
// Show the progress Modal
$('#myModal').modal({
keyboard: false,
backdrop: 'static',
});
$('#myModal').modal('show');
// Billing Information
$(".stepText").delay(800).html('Processing Billing Information');
// I want this ^ to delay the process and make it seem longer.
var name = $("input[name='bill_name']").val();
var address = $("input[name='bill_address_1']").val() + $(
"input[name='bill_address_2']").val();
var city = $("input[name='bill_city']").val();
var state = $("input[name='bill_state']").val();
var zip = $("input[name='bill_zip']").val();
var email = $("input[name='bill_email']").val();
var phone = $("input[name='bill_phone']").val();
var billing = 'name=' + name + '&address=' + address + '&city=' + city +
'&state=' + state + '&zip=' + zip + '&email=' + email + '&phone=' +
phone;
// Shipping Informaiton
$(".stepText").delay(800).html('Processing Shipping Information');
var name = $("input[name='ship_name']").val();
var address = $("input[name='ship_address_1']").val() + $(
"input[name='ship_address_2']").val();
var city = $("input[name='ship_city']").val();
var state = $("input[name='ship_state']").val();
var zip = $("input[name='ship_zip']").val();
var email = $("input[name='ship_email']").val();
var phone = $("input[name='ship_phone']").val();
var shipping = 'name=' + name + '&address=' + address + '&city=' + city +
'&state=' + state + '&zip=' + zip + '&email=' + email + '&phone=' +
phone;
// Payment Information
$(".stepText").delay(800).html('Processing Payment Information');
var number = $("input[name='number']").val();
var expiry_month = $("input[name='expiry_month']").val();
var expiry_year = $("input[name='expiry_year']").val();
var cvv = $("input[name='cvv']").val();
var payment = 'number=' + number + '&expiry_month=' + expiry_month +
'&expiry_year=' + expiry_year + '&cvv=' + cvv;
return false;
}
I want the modal to show some text like shown above based on what step we are on.
Processing Billing Information
Processing Shipping Information
Processing Payment Information
I want this to be delayed because right now as soon as the modal opens it is already on the last step which is the payment statement above.
I hope my question makes sense! Thanks for the help.
You should be using
setTimeout(function(){
// Whatever code to give delay of 3s
},3000);
The simpliest way is to use a timeout
https://developer.mozilla.org/fr/docs/Web/API/Window.setTimeout
setTimeout(function(){ ... }, delayModal) // delayModal integer in ms
If you are using Bootstrap 3
events are namespaces and the show event for modal is show.bs.modal
See http://getbootstrap.com/javascript/#js-events for more details
Your code should be like this :
$('#myModal').on('show.bs.modal', function (e) {
// your script
})
Demo:
http://jsfiddle.net/5960g3xt/1/ <= How you should do
http://jsfiddle.net/5960g3xt/2/ <= I have added some delay on the second so you can see the change
Need some help with this piece of a code. I am able to produce the results I want with the code in Working Code, but when I implement this code on another sheet (which is the master code) it does not work. scratching my head trying to figure this out
Here is the shared google spreadsheet with both full codes. Go to script editor.
Google Docs Link
Any help would be much appreciated. Thank you in advanced.
EDIT#3 Submit section of None Working Code
function submit(e){
var app = UiApp.getActiveApplication();
var sheet = SpreadsheetApp.openById(submissioSSKey).getActiveSheet();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var projectname = e.parameter.projectname;
var projectid = e.parameter.projectid;
var projectmanager = e.parameter.projectmanager;
var salesrep = e.parameter.salesrep;
var duedate = e.parameter.duedate;
var projectphase = e.parameter.projectphase;
var disctype = e.parameter.disctype;
var mediatype = e.parameter.mediatype;
var encryptiontype = e.parameter.encryptiontype;
var password = e.parameter.password;
var quantity = e.parameter.quantity;
var specialinstructions = e.parameter.specialinstructions;
var update = "Colombo Save";
//var sheet = ss.getSheets()[0];
var uiData = [[
projectname,
projectid,
projectmanager,
salesrep,
duedate,
projectphase,
disctype,
mediatype,
encryptiontype,
password,
quantity,
specialinstructions,
update
]];
sheet.getRange(sheet.getLastRow()+1, 1, uiData.length, uiData[0].length)
.setValues(uiData);
var app = UiApp.getActiveApplication();
var result = {};
var numMembers = parseInt(e.parameter.table_tag);
result.members = [];
for(var i=1; i<=numMembers; i++){
var member = {};
member.firstName = e.parameter['fName'+i];
member.lastName = e.parameter['lName'+i];
member.company = e.parameter['company'+i];
member.address = e.parameter['address'+i];
result.members.push(member);
}
var htmlBody = 'Shipping Information: <br>'
for(var a in result.members) {
var member = result.members[a];
var fname = member.firstName;
var lname = member.lastName;
var company = member.company;
var address = member.address;
var timestamp = Utilities.formatDate(new Date(), "America/New_York", "MMMM dd, yyyy hh:mm:ss"); // Timestamp
var activeSessionuser = Session.getActiveUser();//Session.getEffectiveUser(); Get the current user in the spreadsheet
var emailAddress = 'test#email.com'; //Venue Colombo Team
var subject = "**Test Email** DVD Request Submitted - **Test Email**"+ projectname +" - "+projectid+" - "+ projectmanager;
/^var emailBody =*/
var emailBody =
"<br><font color=\"Blue\"><b><h2>Request Submitted</h2></b></font>"
+"<br/>Hi Venue Colombo Team,<br/>"
+"<br/>The following data room(s) will need a disc creation. Please begin bulk save data room and create ISO to upload to the FTP site:<br/>"
+"<br/><b>Project Name:</b> " + projectname
+"<br/><b>Project ID:</b> " + projectid
+"<br/><b>Project Manager:</b> " + projectmanager
+"<br/><b>Sales:</b> " + salesrep
+"<br/>" + htmlBody + 'Client Name: '+ fname + ' ' + lname +'<br>'+ 'Company Name: '+ company +'<br>' + 'Address: ' + address +'<br>'+'<br>'+
+"<br/>"
+"<br/><b>Phase:</b> " + projectphase
+"<br/><b>Disc Type:</b> " + disctype
+"<br/>"
+"<br/><b>Encryption:</b> " + encryptiontype
+"<br/><b>Password:</b> " + password
+"<br/><b>Quantity:</b> " + quantity
+"<br/>"
+"<br/><b>Client Due Date:</b> " + duedate
+"<br/>"
+"<br/><font color=\"Red\"><b>Special Instructions:</b></font> " + "<br/>"+ specialinstructions
+"<i><br/> <br/>This request was submitted by:</i> "
+"<br/><font color=\"blue\">Name:</font> " + activeSessionuser
+"<br/>Time Stamp: " + timestamp
+"<br/>"
+"———————————————————————————————"
+ //Line divider code —
"<br/>Venue Client Services"
+"<br/>United States: "
+"<br/>UK/International: "
+"<br/>France: "
+"<br/>Asia: ";
htmlBody += 'Client Name: '+ fname + ' ' + lname +'<br>'+ 'Company Name: '+ company +'<br>' + 'Address: ' + address +'<br>'+'<br>';
}
var optAdvancedArgs = {name: "Venue Client Services", htmlBody: emailBody};
//MailApp.sendEmail('fake#email.com', subject, '', optAdvancedArgs);
Logger.log(htmlBody);
Logger.log(emailBody);
var html = app.createHTML('First Name: '+ fname + ' ' + lname +'<br>'+ 'Company Name: '+ company +'<br>' + 'Client Address: ' + address);
app.add(html);
//dvdForm();
return app;
}
Here is the result on the Application
Here is the Logger logs
Logger.log(htmlBody);
Logger.log(emailBody);
I was finally able to figure out what the issues was with "for loop statement return undefined values"
I did not add a .addCallbackElement to the panel containing the form fields.