Page 1 of 3

Using Sendgrid in a list

Posted: Wed Oct 15, 2014 4:40 pm
by Mike6979865

Hello,
I have a multiple items that display in a list. For example, I see name, address, email, and problem... I want to click on a button and have that data including the picture forwarded to a specific email that I have listed in a drop down list. Here's what I did, and I hope you'll be be to assist me.

var res = "";
var data = {
Name: Appery('Name')[0].value ? Appery('Name')[0].value : "",
Email: Appery('Email')[0].value ? Appery('Email')[0].value : "",
Image: localStorage.getItem('picture') ? "Image": ""
};

for (ii in data){
if (data[ii] !== ''){
res += "span" + ii + "/span : span " + data[ii] + "/span";
}
}
res += "";

localStorage.setItem('email',res);

This code works fine when there is no list. The button is included with the list. But, it looks like that when I use Appery('Name')... with the list, it doesn't read the value that is displayed in the list. Is that right? Ofcourse I mapped email to html in sendgrid and so forth.. But it doesn't seem to work. Can I access the fields in the list using Appery('..') as specified in the code above?

Regards,


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 5:19 pm
by Evgene Karachevtsev

Hello Mike,

Could you please provide us with public link to your project and steps to reproduce the issue?


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 5:38 pm
by Mike6979865

Hi Evgene,

I'll email you the credentials to a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a.


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 7:12 pm
by Evgene Karachevtsev

Mike,

when I go into the category "view tickets by date" I don't see the button "REFER TO AGENCY", could you please check this?


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 7:49 pm
by Mike6979865

Yes, the button should be in the list. Here's a screenschot

Select the Date 10/15/2014
Click View Tickets By Date
Then it will open another page
scroll down and you'll see this button "REFER TO AGENCY"


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 8:02 pm
by Evgene Karachevtsev

Mike,

Please repeat the screenshot. And this is the screenshot of what we get
Image


Using Sendgrid in a list

Posted: Wed Oct 15, 2014 8:12 pm
by Mike6979865

Hi,

You are doing 10/16/2014. You should select 10/15/2014.


Using Sendgrid in a list

Posted: Thu Oct 16, 2014 9:12 am
by Kateryna Grynko

Hi Mike,

When I click "REFER TO AGENCY" I get Cross-site HTTP request error:

preXMLHttpRequest cannot load ... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://appery.io' is therefore not allowed access./pre


Using Sendgrid in a list

Posted: Thu Oct 16, 2014 6:26 pm
by Mike6979865

Per your response, here's what I should do.

1) You shouldn't add the html and body tags in res
2) The method of mail service must be Post instead of Get
3) If you do not make a hybrid application but html app, for the the mail servers you should use the Appery.io proxy

I changed the method, and added a proxy. What adjustments should I make to this code below? Thank you so much for your assistance.

var res = "";
var data = {
Name: Appery('name')[0].value ? Appery('name')[0].value : "",
Email: Appery('email')[0].value ? Appery('email')[0].value : ""
};
for (ii in data){
if (data[ii] !== ''){
res += "span" + ii + "/span : span " + data[ii] + "/span";
}
}
res += "";
localStorage.setItem('email',res);


Using Sendgrid in a list

Posted: Fri Oct 17, 2014 9:27 am
by Kateryna Grynko

Hi Mike,

First, get current list item and save the link to the element in the 'listItem' variable, and then search for 'name' and 'email' labels inside current list item rather than inside the whole page.

Your fixed code: precodevar res = "<html><body>",
listItem = $(this)&#46;closest('[name="mobilelistitem_25"]'),
name = $('[name="name"]', listItem )&#46;text(),
email = $('[name="email"]', listItem )&#46;text(),
data = {
Name: name ? name : "",
Email: email ? email : "",
},
ii;

for (ii in data){
if (data[ii] !== ''){
res += "<div><span>" + ii + "</span> : <span> " + data[ii] + "</span><>&quot
}
}
res += "</html></body>&quot

localStorage&#46;setItem('email',res);/code/pre