- This topic has 10 replies, 4 voices, and was last updated 11 years, 11 months ago by Pavel Cermak.
-
AuthorPosts
-
Celeste PatinMemberHello:
I’ve developed an APP that has several screens with calculations. Everything ends up on one screen in the form of labels and field results. I want to be able to put all of this information in an email. How would I email the entire last screen of my APP? It does not need to be in a database and the data does not need to be selected for use later. I just need to be able to send the entire screen in an email for documentation.
Can anyone help?
Thank you.
Celeste
KaleMemberHi,
I´m using the following code:
function email() { var firstname, name, senderemail, message; var url, data, targetemail; firstname = $('#m1-email-textField1').val(); name = $('#m1-email-textField2').val(); senderemail = $('#m1-email-textField3').val(); message = $('#m1-email-textArea1').val(); targetemail='email@example.com'; data = firstname + ' ' + name + "%0D%0A" //crlf + senderemail + "%0D%0A" + message; url='mailto:' + targetemail + '?subject=Results from iPhone&body=' + data; window.location.href = url; }
Kale
Celeste PatinMemberKale or Octavio (or anyone who can answer):
Kale you provided the above code to send the data in the RESULTS screen to an email. I tried to write the code to just send 1 field to the email based on your code above and it does not work. Can you tell me what I did wrong? I’ve uploaded the zip below–don’t bother with it not calculating. I’ve figured that out (with your help). I’m just trying to send the results5Field to an email. Can you help?
Or is there another way?
Thank you,
Celeste
Attachments:
You must be logged in to view attached files.
KaleMemberThis code worked in TestCenter:
function email() {
var weekdays;
var url, data, targetemail;
weekdays = $(‘#m1-RESULTS-results5Field’).val();
mailto:targetemail=’email@example.com‘;
data = weekdays;
url=’mailto:’ + targetemail + ‘?subject=Results from iPhone&body=’ + data;
window.location.href = url;
}Set the onclick action of the email button to email()
Kale
Celeste PatinMemberKale:
I still cannot get it to work. After you press the Emailxxx push button a screen appears and says Not found.
Above in the code in blue do I type just as you have it – mailto:targetemail=’email@example.com‘; or do I type a real email address?
Also you say set the onclick action of the email button to email(). Do I put Onclick/Run Javascript then enter updateemail() or do I put Onclick/Go to URL and then enter email().
Feeling dumb again. Thanks for your patience.
Celeste
KaleMemberReplace the example email address with a real email address.
Set the onclick action of the email button to Run JavaScript and enter email()
The function is named email in the source code
function email() {
// magic code
}The function you have called (updateemail()) doesn´t exist 😉
Kale
Celeste PatinMemberKale:
I responded to your email but for some reason it is not showing up. I wanted to thank you for all of your help. IT WORKED. I feel dumb again but someone told me once “if something is not hard for you then you haven’t learned anything”. So true.
A few questions:
When I try to include my “text” (labels) in the email they do not show up. If I were to make them all “textareas” they show up. What is the reason for that? Is it because I have listed them as a .val() and it should be .text() or something?
Also, some of my calculations go on to the nth digit. How do I make them to 2 decimal places?
Thanks again for the help. I really appreciate it.
Celeste
KaleMemberHi,
glad to hear it finally works now 🙂
To get the content of a textfield you want to use .val(), to geht the content of a label you want to use .text()
To round to two digits you could use this code:
function round(z){
z=z*100;
z=Math.round(z);
z=z/100;
return(z);
}Call this function whenever you need it.
For example if you want to calculate the bmi of a person you would do something like this:
var weight = 90;
var height = 1.88;var bmi = round((weight/Math.pow(height,2))); // Is equal to round((weight / (height * height)))
$(‘#m1-bmi-text5’).text(bmi); // Show result in labelKale
Celeste PatinMemberHi Kale or anyone who can help –
Cannot get the rounding to 2 decimals to work
Please look at lines 116-121 in the coding where I have the coding you sent above. I don’t think that I am implementing it correctly.
Please help.
Thank you. Everything else works (cross my fingers).
Celeste
Attachments:
You must be logged in to view attached files.
mreadeMemberTo those interested….
You may want to use the
".toFixed()"
code to set the number of decimal places.
Example:
answer = (sum / sum2).toFixed(3);
This will show you answer as:
12.345
Hope this helps.
Pavel CermakMembermailto:targetemail=’email@example.com‘; (this is right, OK)
How to send a email copy to cc: ???????
mailto:targetcopy=’copies@example.com‘; ?
mailto:copyemail=’copies@example.com‘; ?
mailto:emailbcc=’copies@example.com‘; ?
mailto:emailcc=’copies@example.com‘; ?Thanks
-
AuthorPosts