Mandatory Fields based on other fields

15 views
Skip to first unread message

Aditya Duggal

unread,
Apr 12, 2013, 4:59:38 AM4/12/13
to erpnext-dev...@googlegroups.com
Hi,

I want to make either of the 2 fields as mandatory in a Communication form but somehow the system is not picking the custom script and even if both the CUstomer and Lead are empty the code is making the communication. Kindly let me know if there is any error in the code that I am unable to find, the code is below:

cur_frm.cscript.custom_validate = function(doc) {
    if(doc.customer ==="" || doc.lead ==="") {
        alert("Either Lead or Customer should be filled in Communication");
        system.exit ();
    }
}

Rushabh Mehta

unread,
Apr 12, 2013, 5:03:55 AM4/12/13
to erpnext-dev...@googlegroups.com
use

if(!doc.customer || !doc.lead)

values can also be "null" which is different from ""


--
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...@googlegroups.com.
To post to this group, send email to erpnext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/erpnext-developer-forum/-/vMwC_rneYBgJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Anand Doshi

unread,
Apr 12, 2013, 5:04:02 AM4/12/13
to erpnext-dev...@googlegroups.com
Hi Aditya,


Thanks,
Anand.

On 12-Apr-2013, at 2:29 PM, Aditya Duggal <aditya...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages