This content has been marked as final. Show 6 replies
You would need to do a little checking into the contents of the text
sprite. The lingo command you want is "contains". Look it up for
examples and syntax.
In addition to what you are currently doing (making sure the text
members are not blank), you would also check to see if the email address
member contains the @ sign:
if member("demoEmail").text contains "@" then
That works great Mike. Thanks for your quick reply. One more question...I bet this is harder than what I think, but here goes:
Is there a way that Director can check if the email address the user inputs is a valid email address? I guess this has to do with looking into some kind of database, I just want to know if there is such a thing used by web users and/or developers.
By the way, here is the code with the piece of info you gave me (is there a smarter way of doing this?):
When you say that you want to know if it is a valid email address, do
mean that it is configured in the correct way (firstname.lastname@example.org)? Or do
you mean is it actually an email address that works and is connected to
a valid mailbox? If the former, then testing for the @ sign as well as
perhaps a period will be about the easiest way to do it. You could setup
a regular expression to make sure that the right characters are in the
right locations, or something like that.
If you want to know if the email address actually works, you would need
to send an email to it, or at least contact the server and see if it is
valid. You can use the DirectEmail xtra to do that.
Your code is close, but a better way is to set up a series of tests and
decide which frame to go to based on that...
on mouseUp me
ok=1 --assume it will be ok to continue
--check for blank text members
if member("demoName").text="" then ok=0
if member("demoEmail").text="" then ok=0
if member("demoTN").text="" then ok=0
if member("demoCompany").text="" then ok=0
if member("demoStreetAddress").text="" then ok=0
if member("demoCSZ").text="" then ok=0
--check for email address
if not member("demoEmail") contains "@" then ok=0
if not member("demoEmail") contains "." then ok=0
--if it is ok, then continue...
--if OK has been set to 0 (no) then go to wrong
if ok then
Thanks for your help. Your version certainly looks cleaner and makes more sense. Everything works fine except the part where it checks for "@" and "." it is ignoring that part of the test...any ideas why?
As for the xtra, thanks for pointing me in the right direction, I will let my client know we would need to buy it if he wants that level of detail.
Sorry... forgot the parenthasis. Should be:
if not (member("demoEmail") contains "@") then ok=0
if not (member("demoEmail") contains ".") then ok=0
Mike. This is great...thanks for your help!