Client side script

103 views
Skip to first unread message

Nguyen Do Le Bao

unread,
Sep 9, 2014, 4:21:59 AM9/9/14
to erpnext-dev...@googlegroups.com
Hi guys, 

Having a simple question but can't find an answer after searching ...
Using client script, to hide and unhide based on another field is as simple as: https://gist.github.com/anonymous/707697f105d287703d0e

Is there a way to do the same thing if the field is a subfield belong to Table Item ?

Anand Doshi

unread,
Sep 9, 2014, 4:41:28 AM9/9/14
to ERPNext Developer's Forum
Set "Depends On" property of field_b to:

eval:doc.field_a

or, to toggle based on main form field's value

eval:parent.field_a

-Anand.

--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. 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.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. 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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/0da483b5-707c-4029-9137-a889488525b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rushabh Mehta

unread,
Sep 9, 2014, 4:41:33 AM9/9/14
to erpnext-dev...@googlegroups.com
Open the doctype, open the field row and set "Depends On"


Nguyen Do Le Bao

unread,
Sep 10, 2014, 3:52:11 AM9/10/14
to erpnext-dev...@googlegroups.com
Can you confirm again if it works. Cos I just tried several ways without any effect: 
eval:doc.field_a
eval:doc.field_a==0
eval:doc.field_a=='0'

field_a is a Check Field

Thank you!


On Tuesday, September 9, 2014 4:41:33 PM UTC+8, rushabh wrote:
Open the doctype, open the field row and set "Depends On"

On 09-Sep-2014, at 1:51 pm, Nguyen Do Le Bao <natha...@gmail.com> wrote:

Hi guys, 

Having a simple question but can't find an answer after searching ...
Using client script, to hide and unhide based on another field is as simple as: https://gist.github.com/anonymous/707697f105d287703d0e

Is there a way to do the same thing if the field is a subfield belong to Table Item ?

--
Note:
 
If you are posting an issue,
 
1. ERPNext is a free and open source software and support is given on this forum by a team (https://frappe.io/webnotes). So please consider donating if you find this forum useful (https://frappe.io/buy). Even a small amount would be helpful.
2. 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.
3. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
4. 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+unsub...@googlegroups.com.

Rushabh Mehta

unread,
Sep 10, 2014, 4:58:21 AM9/10/14
to erpnext-dev...@googlegroups.com
On 10-Sep-2014, at 1:22 pm, Nguyen Do Le Bao <natha...@gmail.com> wrote:

Can you confirm again if it works.

Depends on is used in a lot of DocTypes and works. Check "Stock Entry"


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/9b1f798b-423a-485b-9902-eeee454680d6%40googlegroups.com.

Nguyen Do Le Bao

unread,
Sep 12, 2014, 12:05:52 AM9/12/14
to erpnext-dev...@googlegroups.com
Ok it works, but I think it only works on Normal Doctype, not with Child Table. 
Can you give me some example for Child Table as well ? 


Set "Depends On" property of field_b to:
eval:doc.field_a
or, to toggle based on main form field's value
eval:parent.field_a
If this works, it's great but not currently the case for Child Table.

Rushabh Mehta

unread,
Sep 12, 2014, 1:30:08 AM9/12/14
to erpnext-dev...@googlegroups.com
On 12-Sep-2014, at 9:35 am, Nguyen Do Le Bao <natha...@gmail.com> wrote:

Ok it works, but I think it only works on Normal Doctype, not with Child Table. 
Can you give me some example for Child Table as well ? 

Why don't you find out :P

select parent, fieldname from tabDocField where depends_on is not null;


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/8cc99474-e571-4194-97cd-c41d90de30b3%40googlegroups.com.

Nguyen Do Le Bao

unread,
Sep 12, 2014, 3:20:47 AM9/12/14
to erpnext-dev...@googlegroups.com
haha ok my bad! 

Anand Doshi

unread,
Sep 13, 2014, 8:43:53 AM9/13/14
to ERPNext Developer's Forum
Hi.

for child doctypes, you try to set eval:parent.field_a

-Anand.

To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/7f274598-64cf-48c8-bd8c-6513c72c9273%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages