Interactive form

Hi , 

Please I need to create a little form to let users submit there e-mail , and there submitted e-mail go directly to my e-mail , please It has been 2 days that I am trying to do it , but I’ve failed , so please can someone do it and post it here , I will be more then thankful !

So simple :

– Please submit your e-mail below :

          _________

        | e-mail here |

         __________

and then users e-mail go directly to my mail .

THANKS YOU SO MUCH :slight_smile:

@mikecmattar, I think you have two choices:

  1.  Use text field object for user to enter his/her email address, and then have your code send a network request to your server with the email address you received from the user, and have the server do the email – but you’d need to have the server that you can use and know how to script it (using php, python, etc.)

http://docs.coronalabs.com/api/library/native/newTextField.html

http://docs.coronalabs.com/api/library/network/request.html

  1.  Use native.showPopup(“mail”, emailOptions) to utilize the user’s built in email app.

http://docs.coronalabs.com/api/library/native/showPopup.html

Additional link:

http://www.coronalabs.com/blog/2012/01/03/composing-email-and-sms-in-corona/

Naomi

If you simply want to go with native.showPopup option…

[lua]

local emailOptions =

{

    to = “myemail@myemailaddress.com”,

    subject = “Title of the email goes here”,

    body = “If you want to pre-fill the message, it goes here”

}

native.showPopup(“mail”, emailOptions)

[/lua]

Naomi

Edit:  Keep in mind, if you don’t need the body filled, you just don’t include it in the emailOptions table. 

Can I keep the e-mail receiver unchangeable ?

And can I add a message box on submit + I’ve added it on my corona simulator but it gives me an error it says that there is an unexpected error ( the error is in this line : native.showPopup(“mail”, emailOptions) , it says unexpected : " 

THE ERROR HAS BEEN GONE , IT WAS MY FAULT , BUT FOR THE OTHERS 2 QUESTIONS ANY HELP ?

@mikecmattar, about restricting the user from changing the “send to” email address after the email client app is opened by native.showPopup, as far as I know, it’s not possible to programmatically restrict it via corona app.

About adding a “message box on submit”, I don’t understand what you are trying to do.

Naomi

Never mind , but I’ve posted and test it on my mobile but it gives a black screen , any help ?

?

@mikecmattar, I have no idea what you mean by “I’ve posted and test it on my mobile but it gives a black screen.”  

What is the code you are using?

Also, when you say “posted”, do you mean, when you tap on a button that triggers the native.showPopup, it ends up making your app screen to go black?

Naomi

I’ve copied all the following :

and I’ve added it to my main.lua file , then I’ve added the ".apk " file to my phone install it and entered the app but it only gives a black screen  

I don’t see what you copied, but from what you describe, you’ve got some sort of bug with your code.  Do you get error when you launch your code on simulator?  If not, you need to learn how to use adb logcat to see what error you are getting.  

Also, often times, things work on simulator but not on device due to some misspelled file names in the code.  File names are case sensitive.  If you spell “mypix.png” in your code but your png file is actually named “myPix.png”, then it will not load on device.

Naomi

I’ve only added the code , and i haven’t got any error , but it shows a black image on both the sim and the device

How are you putting the app on the device?

I am pressing : File > Build For Android > Copy the .apk file to my device > Installing the app

@mikecmattar, it sounds strange.  Do you see any message on terminal when you launch your app on simulator?  If there’s no error message appearing on terminal window, then… well… this may sound like a stupid question, but do you have any display objects included in your code?  If you have nothing to display, nothing will appear on screen.

Naomi

Actually I forget to added to insert group :stuck_out_tongue:

I’m confused.  I don’t have a “Build for Android” menu item under file.  I have a “Build” and from there I can pick Android.  I’ve never seen a Copy the .apk to my Device or Installing the app menu item. 

@mikecmattar, I think you have two choices:

  1.  Use text field object for user to enter his/her email address, and then have your code send a network request to your server with the email address you received from the user, and have the server do the email – but you’d need to have the server that you can use and know how to script it (using php, python, etc.)

http://docs.coronalabs.com/api/library/native/newTextField.html

http://docs.coronalabs.com/api/library/network/request.html

  1.  Use native.showPopup(“mail”, emailOptions) to utilize the user’s built in email app.

http://docs.coronalabs.com/api/library/native/showPopup.html

Additional link:

http://www.coronalabs.com/blog/2012/01/03/composing-email-and-sms-in-corona/

Naomi

If you simply want to go with native.showPopup option…

[lua]

local emailOptions =

{

    to = “myemail@myemailaddress.com”,

    subject = “Title of the email goes here”,

    body = “If you want to pre-fill the message, it goes here”

}

native.showPopup(“mail”, emailOptions)

[/lua]

Naomi

Edit:  Keep in mind, if you don’t need the body filled, you just don’t include it in the emailOptions table. 

Can I keep the e-mail receiver unchangeable ?

And can I add a message box on submit + I’ve added it on my corona simulator but it gives me an error it says that there is an unexpected error ( the error is in this line : native.showPopup(“mail”, emailOptions) , it says unexpected : "