Experimenting with the display depends on feature in doctype, I have observed that it works properly only when the document is saved. Wondering whether it is a known limitation. If not, I will raise an issue to track this defect.
You can also affect this through a custom script: frm.toggle_display
I checked that as well. It looked like both had the same issue(ie doesn’t work unless the doc is saved). However I didn’t spend much time on toggle_display as it looked slightly difficult to use compared to ‘depends on’ attribute
@Ben_Cornwell_Mott, Thanks, I will give it another try and update. I was suspicious about my implementation, but discounted that due to the ‘depends on’ issue.
Thanks @Ben_Cornwell_Mott, I have managed to get it working using toggle_display now.