Table View for Email Contacts

I’m using the Table View (specifically, the List View 2 example code) and am trying to create a scrolling list that emails a person when there name is tapped. Can I do this? If so, can anyone help?

An excerpt of the code …

– Setup data
local data = {}
for i=1, 158 do
data[i] = {}
data[i].title = "List item "… i
local c = math.modf(i/5)
data[i].category = "Category "… c + 1
data[i].email = ???
end

–Setup functions to execute on touch of the list view items
function listButtonRelease( event )
self = event.target
system.openURL( “mailto:” … ??? )
end

–Add items that have categories
data[1].title = “Brant Myers”
data[1].category = “Administration”
data[1].email = “bmyers@jimned.esc14.net
data[2].title = “Hunter Cooley”
data[2].category = “Administration”
data[2].email = “hcooley@jimned.esc14.net” [import]uid: 36444 topic_id: 9128 reply_id: 309128[/import]

when the user taps on the cell you want to email then call

system.openURL with the mailto tag…

see

http://developer.anscamobile.com/reference/index/systemopenurl

and search forums to learn how to add subject and body to the email

c. [import]uid: 24 topic_id: 9128 reply_id: 33270[/import]

Thanks, Carlos. I appreciate it.

With respect to the mailto tag, I’ve loaded the email address for each cell. How can I access that information when I call system.openURL?

– Setup data
local data = {}
for i=1, 158 do
data[i] = {}
data[i].title = "List item "… i
local c = math.modf(i/5)
data[i].category = "Category "… c + 1
end

–Setup functions to execute on touch of the list view items
function listButtonRelease( event )
self = event.target
system.openURL( “mailto:dhogan@jimned.esc14.net” ) end

–Add items that have categories
data[1].title = “Brant Myers”
data[1].category = “Administration”
data[1].email = “bmyers@jimned.esc14.net
data[2].title = “Hunter Cooley”
data[2].category = “Administration”
data[2].email = “hcooley@jimned.esc14.net” [import]uid: 36444 topic_id: 9128 reply_id: 33272[/import]

self.email

system.openURL( self.email)

try that.

no promises but you should be able to determine the index into the list or the current cell you are in and then pass the email

c. [import]uid: 24 topic_id: 9128 reply_id: 33281[/import]

Nice idea … I tried that earlier with no luck. I’ll try to work with the index for a while. Thanks! [import]uid: 36444 topic_id: 9128 reply_id: 33283[/import]

Got it!

– Setup data
local data = {}
for i=1, 158 do
data[i] = {}
data[i].title = "List item "… i
local c = math.modf(i/5)
data[i].category = "Category "… c + 1
end

– Setup functions to execute on touch of the list view items
function listButtonRelease( event )
self = event.target
local id = self.id
system.openURL( “mailto:”… data[id].email )
end

– Add items that have categories
data[1].title = “Brant Myers”
data[1].category = “Administration”
data[1].email = “bmyers@jimned.esc14.net
data[2].title = “Hunter Cooley”
data[2].category = “Administration”
data[2].email = “hcooley@jimned.esc14.net” [import]uid: 36444 topic_id: 9128 reply_id: 33286[/import]

awesome !

c [import]uid: 24 topic_id: 9128 reply_id: 33289[/import]