Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hide fields based on a condition

 
S D Lalitha Velamuri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 73
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to declare three variable... i did not get your question what you are actually trying to say.
 
S D Lalitha Velamuri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2407
32
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not just have a "Fee" field?
 
S D Lalitha Velamuri
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2407
32
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic