i want to stop the user from going to the next lin...
# suitescript
h
i want to stop the user from going to the next line until the memo field is populated according to a specific pattern. How is this possible?
e
A client script will accomplish what you need but a better approach would be to make that field required by customizing the form. However, if you use that form for CSV uploads, you will need a value for that field.
d
validateLine and use regex
h
i am using validateLine and test validateField script, but my execution goes into infinite loop when retun false
n
Why is there a loop?
Share your code.
n
Why not use it like this: var splittedData = memo.split('/'); var count = splittedData.length; if (count != 2) {
h
ok i try it
@NickSuite but the problem is when we return false.
@NickSuite
n
before returning false, set the field value to blank.
and also check if the field value is blank, then return true.
b
you will probably want to check the behavior in firefox instead
netsuite has unfavorable behavior around alerts changing focus
h
but this is not convenient for the user because the user enters the address/zip code/postal code. if a single value is wrong all data will remove.
n
First try and see if that resolves your problem.
h
@battk yes you are right, facing this issue while using CHROM
@NickSuite i used same issue.
b
check with firefox first
h
no issue with firefox, i checked @battk
message has been deleted
b
you will need to detect when you have already shown the prompt, and return true instead of false in that case
it looks like you have the beginning of that with your flag variable
for example, you can have a showAlert variable set to false when you have recently shown the alert and return true from your validateField if that flag is false
you would want to use setTimeout to set the showAlert flag back to true for when you would want to show alerts again
d
You should use validateLine, not field. Every time the user changes a value it's going to run this code. If the user doesn't fill out the memo LAST then it will always return false because the zip, security code, etc is not there. You're memo code does not need the loop for the '/' since you're already splitting the memo just read the
splittedData
array length.