Hi,
I have a form that changes various object's presence based on an amount range similar to this:
switch (true)
{
case this.rawValue >= 1 && this.rawValue <= 49999:
Subhead1.presence = "visible";
Subhead2.presence = "hidden";
break;
case this.rawValue >= 50000 && this.rawValue <= 250000:
Subhead1.presence = "hidden";
Subhead2.presence = "visible";
break;
default:
Subhead1.presence = "hidden";
Subhead2.presence = "hidden";
}
As an enhancement, I would like to add a pull-down selection field that changes the amount ranges based on the pull-down selection.
Can anyone offer any advice?
Thanks,
Eric
Views
Replies
Total Likes
Hi Eric,
Here's one approach, there would be many especially if there is some sort of formula defining the min and max values. With this approach I am assuming there isn't and the drop down values are Small, Medium and Big,
var ranges
switch (DropDownList1.rawValue)
{
case "Small":
ranges = { option1 : {min:0, max:499}, option2 : {min:500, max:2500} };
break;
case "Medium": ranges = { option1 : {min:0, max:4999}, option2 : {min:5000, max:25000} };
break;
default: ranges = { option1 : {min:0, max:49999}, option2 : {min:50000, max:250000} };
break;
}
switch (true)
{
case this.rawValue >= ranges.option1.min && this.rawValue <= ranges.option1.max:
Subhead1.presence = "visible";
Subhead2.presence = "hidden";
break;
case this.rawValue >= ranges.option2.min && this.rawValue <= ranges.option2.max:
Subhead1.presence = "hidden";
Subhead2.presence = "visible";
break;
default:
Subhead1.presence = "hidden";
Subhead2.presence = "hidden";
}
Regards
Bruce
Views
Replies
Total Likes