Using Jquery we can show/hide the input box based on the Spotfire Drop Down selection.
Lets assume we have created a Drop-Down Property control with Fixed Values
as Enable and Disable as below
Also, create a Input property control.
Drop -Down Property Control ID: 163473c4bab648778b3e64c40463e3f
Input Text Box Control ID: c8b6b12144864ec5889005c6260a4b08
Now our aim is to show/hide the Input Text box based on the Drop down selection.
The default HTML would look like below:-
Click on JSscript Button and create below script as below:-
Lets assume we have created a Drop-Down Property control with Fixed Values
as Enable and Disable as below
Also, create a Input property control.
Drop -Down Property Control ID: 163473c4bab648778b3e64c40463e3f
Input Text Box Control ID: c8b6b12144864ec5889005c6260a4b08
Now our aim is to show/hide the Input Text box based on the Drop down selection.
The default HTML would look like below:-
Click on JSscript Button and create below script as below:-
JScript will triggered whenever the Drop Down selection is changed.
$("#163473c4bab648778b3e64c40463e3fc").change(function()
{
var value = $("#163473c4bab648778b3e64c40463e3fc").val(); //To capture the index
var vt = $("#163473c4bab648778b3e64c40463e3fc option:selected").text(); //To Capture the selected text
if(vt== "Enable") //If the Drop Down selected value is Enable
{
$("#c8b6b12144864ec5889005c6260a4b08").show(); //Making the Input Box visible
}
else
{
$("#c8b6b12144864ec5889005c6260a4b08").hide(); //Making the Input box element hidden
}
}
var value = $("#163473c4bab648778b3e64c40463e3fc").val(); //To capture the index
var vt = $("#163473c4bab648778b3e64c40463e3fc option:selected").text(); //To Capture the selected text
if(vt== "Enable") //If the Drop Down selected value is Enable
{
$("#c8b6b12144864ec5889005c6260a4b08").show(); //Making the Input Box visible
}
else
{
$("#c8b6b12144864ec5889005c6260a4b08").hide(); //Making the Input box element hidden
}
}
);
Hey for me its not working properly.... its hiding again its showing the text box....
ReplyDeletewhich version of Spotfire you are using?
ReplyDeleteit's working...superb example for me...
ReplyDeleteThis solution is not working with Spotfire 7.5 and higher. Can anyone help on this?
ReplyDeleteSpotfire is not recognising the change event :(
DeleteI really enjoyed while reading your article, the information you have mentioned in this post is really good. I am waiting for your upcoming post.
ReplyDeleteBest Career in SAS Training Course with Highly package
Want to Learn Python Programming Training with Placement Support