ClientScript validateLine() doesn't get called whe...
# suitescript
c
ClientScript validateLine() doesn't get called when you add items using the 'add multiple' button. I want to check for duplicate line item entries, anyone know what can get triggered in a client script in this scenario? (Purchase Order) I can inspect the item sublist in beforeSave() in a UE but I'd rather catch this at the time of line item entry where possible. Edit: validateInsert() doesn't get called either.
v
@Craig It's a bit complex. We need to catch the click event by using javascript.
c
What do you mean exactly? Are you suggesting looking at the DOM?
v
yes
c
Ouch
So there's no way to catch it using standard SS
Any code that looks at the DOM will fail as soon as the DOM changes
v
no
c
Really?
getElementById ?
v
well, not just look at the dom.
just catch the clicking event of the button.
and override the callback function.
c
and that requires the button ID being static right?
As soon as that changes, the code won't work anymore?
I assume it rarely changes but it's definitely a risk,
v
maybe
but as far as I know, validate func should be triggered. I am not sure.
actually there is no risk
a
The best thing you can do with Add Multiple when it comes to Client Side validation is to hide the button. That button implementation does not align with the Client Script design/behavior, big screw up by NetSuite on that one.
💯 1
😂 1