Send email with error if SQL connection has error

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

jonney.corner
Ebase User
Posts: 1
Joined: Wed Apr 17, 2013 11:53 am

Send email with error if SQL connection has error

#1

Postby jonney.corner » Wed Apr 17, 2013 12:36 pm

Hello there,

We are currently looking into finding a way to hide an error message from the users web browser if e.g. they add letters into an ebase form field, but in the SQL database it only allows date format.

We want the form to 'Catch' any errors if generated and send them straight to the email resource so we get an email with the values they have added in an e-mail so we can add them to our servers manually (only if there is an error between the form and SQL server.

If you could post us a solution we would be very great full,

Thanks,
Jonathan
0 x

ehmd
Ebase User
Posts: 53
Joined: Thu Sep 13, 2007 9:02 am
Contact:

#2

Postby ehmd » Wed Apr 17, 2013 1:11 pm

Is there any reason why you can't validate the input from the user on the form, to ensure that the entered data is a validate date and doesn't contain letters ?

The error wouldn't be thrown by the form if the data was valid ?
0 x

ehmd
Ebase User
Posts: 53
Joined: Thu Sep 13, 2007 9:02 am
Contact:

#3

Postby ehmd » Wed Apr 17, 2013 1:14 pm

If you want a generic catch all way of trapping unexpected error, you can use the On Error event. See http://dev-docs.verj.io/ufs/doc/Underst ... c250644759 for further details.
0 x

User avatar
Wai
Moderator
Moderator
Posts: 165
Joined: Wed Sep 12, 2007 9:04 am
Location: Sandy, UK
Contact:

#4

Postby Wai » Wed Apr 17, 2013 3:20 pm

Is this only for Date fields, or is this for any other data type?

For dates, you wouldn't be able to submit the form to the SQL server if the value is not a date. The system client side validation will prevent you from doing so. If you want to allow the user to enter characters, then make it a character field on the form.

Rather than letting a SQL error be generated, perform your own validation in script to check if the value conforms to the correct value expected by your database.

If validation in your script fails, you can just send the email and not save to the DB at this point, but still shows confirmation message to the user.
0 x


Who is online

Users browsing this forum: No registered users and 13 guests