NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: jking on March 04, 2019, 12:17:44 PM
-
On a form, when accepting an Insert, I look into another file to see if a specific email address has been used before. If so, I display an Alert warning to the user, that the email has been used. I then return to the form, but it is no longer responsive. That is, the Save button does not work, all I can do is cancel. Here is my code, in the Validate, Insert, End embed:
If loc:Create_Login_Account = 1
Usr:EMail = Phys:Physician_EMail_Address
If Access:Users.Fetch(Usr:EMail_key) = Level:Benign !check to see if account already exists
!message that account exits
p_web.Script('alert("Account(Email address) already exists!");')
Return('')
ELSE
Usr:Institution_ID = Phys:Institution_ID
Usr:Last_Name = Phys:Physician_Last_Name
Usr:First_Name = Phys:Physician_First_Name
Usr:MI = Phys:Physician_Middle_Initial
Usr:Level = 50
Usr:Salt = st.Random(8,st:upper)
Usr:Password = st.Random(8,st:upper)
Usr:EMail = Phys:Physician_EMail_Address
Usr:ForcePasswordChange = 1
Access:Users.Insert()
!!loc vars for email control here
END!IF
END
I'm not sure I'm using Return correctly. Any suggestions?
Thanks,
Jeff King
-
Hi,
Normally I would do the checking in the ValidateAll embed of the form.
When the email-address already exists:
Usr:EMail = Phys:Physician_EMail_Address
If ~Access:Users.Fetch(Usr:EMail_key) !check to see if account already exists
LOC:ALERT = 'Account(Email address) already exists!' ! = the message you want to show
LOC:INVALID = 'Phys:Physician_EMail_Address' ! = Email-address equate (points to the field in question)
exit ! Leave routine and show message
end
This way, a popup alert or a message at the top of the screen will appear, depending on your app settings.
I know about (and follow) your quest to create a (mobile) app so probably a different approach is needed here.
But in a web based app I would do it like this.
Cheers,
Rene
-
Rene,
Thanks! I'll give this a try. Note, this particular case is for a normal web based app, not the mobile app I'm still working on.
Jeff
-
Rene,
Your suggestion worked perfectly. Thank you!
Jeff