Extending existing js function

Hi,

I can extend cur_frm.cscript.onload function by writing cur_frm.cscript.custom_onload function on the client side.  It works fine. There is an existing function called 'cur_frm.cscript.get_leave_balance'  in leave_application.js file on the server. Can I extend this function by writing another function on the client side called 'cur_frm.cscript.custom_get_leave_balance' ? Thanks,



Kind regards,
MP



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
It is not possible to extend cur_frm.cscript.get_leave_balance() through custom_get_leave_balance() function. But you can overwrite the function by redefining the same function inside custom client script.

On 13-Jan-2014, at 8:00 PM, MP wrote:

Hi,

I can extend cur_frm.cscript.onload function by writing cur_frm.cscript.custom_onload function on the client side.  It works fine. There is an existing function called 'cur_frm.cscript.get_leave_balance'  in leave_application.js file on the server. Can I extend this function by writing another function on the client side called 'cur_frm.cscript.custom_get_leave_balance' ? Thanks,



Kind regards,
MP



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Thanks Nabin.

Is there a list of a standard functions that can be extended by writing client side script? Thanks.

Kind regards,
MP.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
Standard functions like onload, onload_post_render, refresh, validate etc are extendable with prefix custom.

Apart from those, all onchange trigger functions which are defined as cur_frm.cscript.fieldname (old style) or fieldname: are extendable.

On 13-Jan-2014, at 10:05 PM, MP wrote:

Is there a list of a standard functions that can be extended by writing client side script? Thanks.



Note:

 

If you are posting an issue,

  1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
  2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
  3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.

     

    End of Note



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.

    For more options, visit https://groups.google.com/groups/opt_out.
1 Like

can you post some example for this?

@abrarpv97, it’s for an legacy api that already have been deprecated, If I’m not wrong, in frappe-v8

1 Like