How to prevent the submit button

How to prevent the submit button in submitable doctype if the status is not true.
Can we Disable the submit button ?

@Owaishk08 create a workflow

1 Like

Yes, you can disable the Submit button in a submittable DocType based on the status field. You can achieve this by overriding the Submit button using JavaScript or Python.

can you explain with code example.

@Owaishk08 there is no code . open workflow list , add new workflow , select your doctype . in first table add draft code 0 , submitted code 1 and cancelled code 2 .
in second table add draft - > submit (action submitted) and in condition write doc.status == False .

@bahaou creating workflow is the best solution , I am asking to @ashiucristo about overriding.

1 Like