Stop redirection after a record producer submit

hichamlasfar
Kilo Contributor

Hello,

I want to developp a record producer that contains a field wit h name: receipt_number (it should numeric in 15 chars), on submit I have to validate this field. to do that I added the following script:

En-tĂȘte 1

var receiptNumber = producer.receipt_number;

if(receiptNumber.toString().length != 15 || isNaN(receiptNumber)){

  gs.addErrorMessage('The receipt number should be in 15 digits.');

current.setAbortAction(true);

// code to add here in order to stop redirection!?

}

The validation works, but the problem is that I have to stop redirection in case of error. Can you find how I can do it (stop the redirection and stay in the current form view)

Thanks in advance!!

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

You can write an onSubmit client script and do your validation there and return false; to stop the submission.


View solution in original post

3 REPLIES 3

Abhinay Erra
Giga Sage

You can write an onSubmit client script and do your validation there and return false; to stop the submission.


Thank you very much, it works


Glad I could help