0

I'm trying to validate 'vatregnumber' field on the Vendor record, Here is my sample code. It works in Mozilla but in Chrome it messages infinite loop.

function clientValidateField(type, name, linenum) {
    if (name === 'vatregnumber') {
        var isValid = validateTaxNum();  // a function returns boolean. If it returns false it gives an alert message. //
        return isValid;
    }

    return true; 
}

I agree that this similar question has been asked, but is there any way to slove these kind of troubles

Zain Shaikh
  • 6,013
  • 6
  • 41
  • 66
niso
  • 85
  • 2
  • 14
  • You have the `return true;` statement outside of both `if` blocks - is this what you want? Not sure whether it could cause the issue you're talking about, but if I understand what you're trying to do, you should have the `return true;` just before the last closing brace `}` otherwise it will return true on every other field too. – Krypton May 05 '17 at 12:28
  • yeah, you are right. I tried as you said, but anything is changed, same inifinite message's occurs – niso May 05 '17 at 13:44
  • 1
    That code should not create a loop. I've done lots of validation that works across browsers. Can you paste all of your code? Or at least the entire validation function? Do any other functions call the validate function? – bknights May 05 '17 at 16:06
  • @bknights I cheked in Mozilla, it works as expected, I think there is no problem with the client script. Here is my code . `function clientValidateField(type, name, linenum) { if (name === 'vatregnumber') { var isValid = validateTaxNum(); // a function returns boolean. If it returns false, it gives an alert message. // return isValid; } return true; }` – niso May 09 '17 at 06:49
  • Do you have any other client scripts running? – bknights May 09 '17 at 19:13
  • yes, except it, I'm using validateLine and SaveRecord functions on the same form – niso May 10 '17 at 13:45
  • I just came across [this question and comment](http://stackoverflow.com/questions/43268980/netsuite-suitescript-why-does-this-validate-field-script-enter-an-infinite-l); saying it's an issue in Chrome 57. – Krypton May 11 '17 at 17:20
  • @Krypton, yeah the cause is Chrome defect, i think – niso May 12 '17 at 07:52

0 Answers0