Hi all, is there any equivalent of alert function ...
# suitescript
n
Hi all, is there any equivalent of alert function that can be used in a Suitelet form submission? I have tried using an alert function in the suitelet - in case a selection is not done by the user - but the alert did not work - I confirmed that the condition is met as I can see the log in execution log.
b
are you doing the alert in your client script file or in your suitelet file
n
alert in suitelet
I was thinking if there is any equivalent of alert function in suitelet?
b
its far too late for an alert once it hits the suitelet
suitelet is server code, the user's browser has already submitted the request by the time it hits the suitelet code
its also why there is no alert for the server. there is nobody to show the alert to. the server is running the code, not the browser
n
Got it. We have this legacy script which is basically a survey script - user chooses a rating on 1-10 & a comment- suitelet captures the rating & comment and sends it back to NetSuite--> we saw recently there was no exception handling if a user does not choose a rating - the suitelet just errors out in that case
So, I was thinking to put an alert but maybe we should just capture the rating if rating!= 'undefined' -> if a user does not choose a rating then suitelet will just proceed with the rest of the script
b
if your survey is a suitelet, you can attach a client script to the form to do your validation
n
form.setscript ?
b
that said, the general serverside advice is to not trust the client. so you should do the validation serverside
im assuming its suitescript 1
n
yes, it is
thanks!