Hi All Any one knows if you can block a save actio...
# suitescript
k
Hi All Any one knows if you can block a save action with a UE beforeSubmit script or does it need to be a client script?
b
Throw an error
p
you can throw a JS exception (that can be a NS error object as battk says) in a beforeSubmit. That being said, that's your equivalent to "server side validation". If possible you should also try to do client side validation for a better UX if it's a common scenario, because the error page looks nasty and the user loses all progress of record creation/editing
d
@PabloZ you can do the validation in saverecord if your validation fails return false from savrecord function, which will block user from saving the record, additionally if you need you can show an alert before returning false.
n
Potentially better than alert use the message module to display a NetSuite style inline message and return false.
💯 1