wood burning stoves 2.0*
The moose likes Groovy and the fly likes Hide fields based on a condition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Languages » Groovy
Bookmark "Hide fields based on a condition" Watch "Hide fields based on a condition" New topic
Author

Hide fields based on a condition

S D Lalitha Velamuri
Greenhorn

Joined: May 17, 2012
Posts: 3


Hi,

I am new to groovy script. How to make some fields hide basing on a condition. Suppose if there are 3 variables let us say A, B, C.

If C value equals to A, then A only should display and B should hide. If C value equals to B, then B only should display and A should hide.

Please any one can help me out in this issue.

Thanks in advance.

Regards,
Lalitha.


Ashish Agre
Ranch Hand

Joined: Jan 22, 2011
Posts: 73

You want to declare three variable... i did not get your question what you are actually trying to say.


| B.E IT | SCJP 6.0 98 % |
S D Lalitha Velamuri
Greenhorn

Joined: May 17, 2012
Posts: 3
Hi,


Thanks for your response. Suppose if 3 Variables are there Courses(Enumeration Values: C Lang, JAVA), Fee of Java, Fee of C. If I select Courses as "Java", then Fee of Java field only display and Fee of C should hide. If I select Courses as "C Lang", then Fee of C field only display and Fee of Java should hide. I need this by using Groovy script.


Thanks and Regards,
Lalitha.
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1726
    
  14

Why not just have a "Fee" field?


No more Blub for me, thank you, Vicar.
S D Lalitha Velamuri
Greenhorn

Joined: May 17, 2012
Posts: 3
Hi,


I just explained the requirement by giving a sample example. My requirement is on selecting one enumeration value, the related fields should only display and other fields should hide. I need it in groovy script.


Thanks and Regards,
Lalitha.
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1726
    
  14

I don't really understand your requirement, and it's a while since I did any Groovy anyway (unfortunately!), so I apologise if this isn't any help, but here goes.

Your data seems to consist of just two variables, Course and Fee, because each course has a fee. And because the course and fee are linked, you can model them e.g. as a map, which would then allow you to select the fee for the chosen course and display it however you want. Here's a really simple example:


Of course, if your Course needs extra attributes and behaviour, then you'd probably need to think about modelling it as a separate class instead.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hide fields based on a condition