Mandatory Attachment

I used the script form github to make attachments mandatory but not even when something is attached the error message comes up and it won't let me save anything. What am I doing wrong?



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.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/8591cee7-c7a8-485c-a888-65ccde72c149%40googlegroups.com.

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

Nate,

You need to share your code and the error message via pastebin or gist

body{font-family:Helvetica,Arial;font-size:13px}body { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; padding:1em; margin:auto; background:#fefefe; }

h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}

h1 {
color: #000000;
font-size: 28pt;
}

h2 {
border-bottom: 1px solid #CCCCCC;
color: #000000;
font-size: 24px;
}

h3 {
font-size: 18px;
}

h4 {
font-size: 16px;
}

h5 {
font-size: 14px;
}

h6 {
color: #777777;
background-color: inherit;
font-size: 14px;
}

hr {
height: 0.2em;
border: 0;
color: #CCCCCC;
background-color: #CCCCCC;
}

p, blockquote, ul, ol, dl, li, table, pre {
margin: 15px 0;
}

a, a:visited {
color: #4183C4;
background-color: inherit;
text-decoration: none;
}

#message {
border-radius: 6px;
border: 1px solid #ccc;
display:block;
width:100%;
height:60px;
margin:6px 0px;
}

button, #ws {
font-size: 12 pt;
padding: 4px 6px;
border-radius: 5px;
border: 1px solid #bbb;
background-color: #eee;
}

code, pre, #ws, #message {
font-family: Monaco;
font-size: 10pt;
border-radius: 3px;
background-color: #F8F8F8;
color: inherit;
}

code {
border: 1px solid #EAEAEA;
margin: 0 2px;
padding: 0 5px;
}

pre {
border: 1px solid #CCCCCC;
overflow: auto;
padding: 4px 8px;
}

pre > code {
border: 0;
margin: 0;
padding: 0;
}

#ws { background-color: #f8f8f8; }

table {
border-collapse: collapse;
font-family: Helvetica, arial, freesans, clean, sans-serif;
color: rgb(51, 51, 51);
font-size: 15px; line-height: 25px;
padding: 0; }

table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }

table tr:nth-child(2n) {
background-color: #f8f8f8; }

table tr th {
font-weight: bold;
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

table tr td {
border: 1px solid #cccccc;
margin: 0;
padding: 6px 13px; }

table tr th :first-child, table tr td :first-child {
margin-top: 0; }

table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }

.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }


Thanks,
Anand Doshi.

On 15 April 2014 at 4:27:20 am, Nate Gallery (ga…@gmail.com) wrote:

I used the script form github to make attachments mandatory but not even when something is attached the error message comes up and it won't let me save anything. What am I doing wrong?
--
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.

To view this discussion on the web visit
https://groups.google.com/d/msgid/erpnext-developer-forum/8591cee7-c7a8-485c-a888-65ccde72c149%40googlegroups.com
.

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



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.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/etPan.534cceaa.1f16e9e8.2fb%40apdmacbook.local.

    For more options, visit https://groups.google.com/d/optout.
I used the following code:

cur_frm.cscript.custom_validate = function(doc) {
    if(!doc.__islocal) {
        if(!doc.file_list) {
            var msg = wn._("Please attach atleast 1 file");
            msgprint(msg);
            throw msg;
        }
    }
}

And I get the error code please attach at lest 1 file even when something is attached.


On Monday, April 14, 2014 11:16:10 PM UTC-7, Anand Doshi wrote:

Nate,

You need to share your code and the error message via pastebin or gist


Thanks,
Anand Doshi.

On 15 April 2014 at 4:27:20 am, Nate Gallery wrote:

I used the script form github to make attachments mandatory but not even when something is attached the error message comes up and it won't let me save anything. What am I doing wrong?
--
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.

To view this discussion on the web visit
https://groups.google.com/d/msgid/erpnext-developer-forum/8591cee7-c7a8-485c-a888-65ccde72c149%40googlegroups.com
.

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



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.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/f25469d4-732a-4880-b596-e3c086e9859c%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
More specifically I used:

cur_frm.cscript.custom_validate = function(doc) {
    if(!doc.__islocal) {
        if(!doc.file_list) {
            var msg = wn._("Please attach atleast 1 file");
            msgprint(msg);
            throw msg;
        }
    }
}

This does give the error message when nda_expiration_date is populated but when I do attach something the message still comes up.


On Thursday, April 17, 2014 11:35:48 AM UTC-7, Nate Gallery wrote:
I used the following code:

cur_frm.cscript.custom_validate = function(doc) {
    if(!doc.__islocal) {
        if(!doc.file_list) {
            var msg = wn._("Please attach atleast 1 file");
            msgprint(msg);
            throw msg;
        }
    }
}

And I get the error code please attach at lest 1 file even when something is attached.


On Monday, April 14, 2014 11:16:10 PM UTC-7, Anand Doshi wrote:

Nate,

You need to share your code and the error message via pastebin or gist


Thanks,
Anand Doshi.

On 15 April 2014 at 4:27:20 am, Nate Gallery wrote:

I used the script form github to make attachments mandatory but not even when something is attached the error message comes up and it won't let me save anything. What am I doing wrong?
--
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.

To view this discussion on the web visit
https://groups.google.com/d/msgid/erpnext-developer-forum/8591cee7-c7a8-485c-a888-65ccde72c149%40googlegroups.com
.

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



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.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/9673a739-24b8-4b9d-bd97-65f5dec59ca9%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
In version 3, to get attachments in the current form doc:

cur_frm.get_docinfo().attachments

Run this in your js console to see what comes up.


On Friday, April 18, 2014 12:19:28 AM UTC+5:30, Nate Gallery wrote:
More specifically I used:

cur_frm.cscript.custom_validate = function(doc) {
    if(!doc.__islocal) {
        if(!doc.file_list) {
            var msg = wn._("Please attach atleast 1 file");
            msgprint(msg);
            throw msg;
        }
    }
}

This does give the error message when nda_expiration_date is populated but when I do attach something the message still comes up.




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.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/cf8153a3-4f43-4b65-9312-2d2d27f51860%40googlegroups.com.

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

Hi , I m trying to used the following script for my sales orders, from Github to make attachement mandatory but when i submit the SO, nothing happen and the document doesn’t get submitted and stay has draft… Did i miss something ?

cur_frm.cscript.custom_validate = function(doc) {
if(!doc.__islocal) {
if(!doc.file_list) {
var msg = wn._(“Please attach atleast 1 file”);
msgprint(msg);
throw msg;
}
}
}