Regarding writing custom script

I am trying to call this custom script on
on_submit of sales order but its not calling or when i am testing this
code of this script from console its working properly.
cur_frm.cscript.custom_on_submit = function(doc) {
confirm(__("Quotation ") + doc.sales_order_details[0].prevdoc_docname);

Can anyone help me on this.

Replied on earlier post. Please don’t post same question multiple times.