How to identify type in validate function?

In ‘validate’, I want to identify whether current call is for ‘Save’ or ‘Submit’.

 validate: function () {
     if( Some_condintion ){
            // this is while saving.
      }else if( Some_condintion ){
            // this is while Submiting.

Can anyone help?

Validate is triggered by both events Save as well as submit.

What is your use case?

I need to calculate TDS in purchase invoice only and only if purchase invoice in going to submit. In short I need ‘before submit’ event. I can not do is in “Submit”

So you can use before_submit instead of validate

Thank yo @Sangram, It works… :slight_smile: