Good day all;
Looks like I am batting “0” today. For some reason I am not able to get a number of things to work today… Maybe I should just write this day off as a loss..;>))
Any way; I am trying, without success to get sub forms to become visible depending on what is selected from a dropdown. I have tried using “switch” (see below) but I end up getting the famous “Syntax” error.
I have also tried an “if” (see below) statement, but that did not seem to work either.
What I would like to have happen is when a user selects 1 of 2 choices 1 of 2 sub forms becomes visible.
As well, if the user has initially selected the wrong dropdown and they select now select the correct one, I would like the incorrect sub form to become invisible again.
I would appreciate any help
switch (this.rawValue)
{
case "2":
staffing_inter.presence = "visible";
else
staffing_inter.presence = "hidden";
break;
}
IF statement
if(this.rawValue = 2 )
{
staffing_inter.presence = "visible"
}
else{
staffing_inter.presence = "hidden";
}
Solved! Go to Solution.
Views
Replies
Total Likes
Couple of things...
Switch() statements don't use "else". You have to specify each value. But you can nest other code inside a switch() statement.
Using a dropdown you have to get the new value when the selection is made.
So (this assumes you've done "Specify Item Values" on the Binding tab for the DDL):
var newValue = this.boundItem(xfa.event.newText);
switch(newValue){
case "1":
//code
break;
case "2":
//code
break;
//etc.
}
Or with your if statement:
var newValue = this.boundItem(xfa.event.newText);
if(newValue = 2){
staffing_inter.presence = "visible"
}
else{
staffing_inter.presence = "hidden";
}
Views
Replies
Total Likes
Couple of things...
Switch() statements don't use "else". You have to specify each value. But you can nest other code inside a switch() statement.
Using a dropdown you have to get the new value when the selection is made.
So (this assumes you've done "Specify Item Values" on the Binding tab for the DDL):
var newValue = this.boundItem(xfa.event.newText);
switch(newValue){
case "1":
//code
break;
case "2":
//code
break;
//etc.
}
Or with your if statement:
var newValue = this.boundItem(xfa.event.newText);
if(newValue = 2){
staffing_inter.presence = "visible"
}
else{
staffing_inter.presence = "hidden";
}
Views
Replies
Total Likes
Also, the double equal sign in the test for the if statement...
Views
Replies
Total Likes
Oops missed that! Thanks Niall!
Views
Replies
Total Likes
Thank you Jono and Niall;
I was looking through the forum and found a post by Niall that appears to be working; I was wondering if this should be used or the one that Jono has posted...
staffing_inter.presence = "hidden";
staffing_inter.preAsence = "hidden";
// Then show the appropriate one
if (this.rawValue == "2") {
staffing_inter.presence = "visible";
}
else if (this.rawValue == "3") {
staffing_exter.presence = "visible";
}
Views
Replies
Total Likes
Whatever works for your needs - that's going to partially depend on your layout and what is visible/not visible at the start.
Views
Replies
Total Likes
Thanks Jono;
It seems that this request is still evolving.. Go figure.. ;>))
Thanks again
Chomp
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies