I have a dropdown with yes or no in the list when "yes" is selected I want a textfield to appear.
(dropdown is named "Snow" and the textfield is named "Ifyes"
I have the following code
if (Snow.rawValue == "1")
{
Ifyes.presence = "visible";
}
else
}
Ifyes.presence = "hidden";
}
It is not working in the "Change" Event
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Oops, my bad. It should be this.boundItem and not this.boundItems. Just remove the s and it should work
Views
Replies
Total Likes
This will not work in the change event as Snow.rawValue does not contain the correct value since the form is the process of changing it. Only when the change action has completed does the rawValue contain the correct updated value. Instead the object change value is stored in an xfa.event object. xfa.event.newText contains the newly selected item of the drop down ( the display string) so it would be
if ( xfa.event.newText == "Yes")
{
...
}
if you bind display values to item values in the dropdown, it would be
if ( this.boundItems ( xfa.event.newText ) == "1" )
{
...
}
Views
Replies
Total Likes
You could add a textfield and put your script that textfield's change event and then make that new textfield invisible. Just make sure that your bracket after "else" is the correct way.
Views
Replies
Total Likes
It is still not working for me. This is what I have in the change event:
if ( this.boundItems ( xfa.event.newText ) == "1"
}
Ifyes.presence = "visible";
}
else
}
Ifyes.presence = "hidden";
}
Views
Replies
Total Likes
The javascript syntax is incorrect for the if statement. Should be something like
if ( this.boundItems ( xfa.event.newText ) == "1")
{
Ifyes.presence = "visible";
}
else
{
Ifyes.presence = "hidden";
}
Have you got the dropdown items set to "1"? and set the script to javascript?
Views
Replies
Total Likes
This is still not working for me.
Language is set for JavaScript
Binding Tab Value for Yes is 1
No is 2
Script is in the change event of the Snow dropdown list
There is no script in the Ifyes textfield
I am at a lost don't know what could be wrong!
Views
Replies
Total Likes
Oops, my bad. It should be this.boundItem and not this.boundItems. Just remove the s and it should work
Views
Replies
Total Likes
Yes, it works!
Thanks so much!
Views
Replies
Total Likes
Views
Likes
Replies