Auré
Auré

Reputation: 161

Implementing Javascript in Spotfire

I have a drop down list with two value ("START" & "END"). Conditionnality to this drop down value, I want to display a specific DIV or another.

I tried to implement the following code but it isn't working. When I change the value in my drop down input nothing's happen.

The drop down id is : 5e64c4918c4b473a8ed1c55264aca3d9 .

HTML code :

<P align=left><FONT size=2>Choice : <SpotfireControl id="5e64c4918c4b473a8ed1c55264aca3d9" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT>
<DIV id="div1"><FONT size=2>List 1 :&nbsp;</FONT>&nbsp;<SpotfireControl id="5f252f7f373d48debc33bfde6fd7dd65" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV id="div2"><FONT size=2>List 2 :</FONT> <SpotfireControl id="136584e6f10143c9ade2a82f5cf4fef0" /></DIV>
<P>
<P align=left>&nbsp;</P>
<P align=left>&nbsp;</P>
<P align=left>&nbsp;</P>
<P><SpotfireControl id="42a0fbc386184501903389b4c48155a5" /></P>        

My Javascript code is the following :

//Triggering the script if Drop Down selection is varied
$("#5e64c4918c4b473a8ed1c55264aca3d9").change(function()
{
var value = $("#5e64c4918c4b473a8ed1c55264aca3d9").val();  //To capture the index
var vt = $("#5e64c4918c4b473a8ed1c55264aca3d9").text(); //To Capture the  selected text
if(vt== "START")   //If the Drop Down selected value is Start
{
    $("#div1").show(); //Making the Input list visible 
    $("#div2").hide();
}
else
{
    $("#div1").hide(); //Making the Input list element hidden
    $("#div2").show();
}
}
);

I've also created an iron python script that I've linked to my drop down list :

Ironpython script :

from Spotfire.Dxp.Application.Visuals import HtmlTextArea
ta.As[HtmlTextArea]().HtmlContent += " "

where ta is an input of type "Visualization".

Could you help me?

Thanks in advance

Upvotes: 1

Views: 810

Answers (1)

Aur&#233;
Aur&#233;

Reputation: 161

As on.click isn't supported, I have deleted on.click statement and it's working !

//Triggering the script if Drop Down selection is varied
var value = $("#5e64c4918c4b473a8ed1c55264aca3d9").val();  //To capture the index
var vt = $("#5e64c4918c4b473a8ed1c55264aca3d9").text(); //To Capture the  selected text
if(vt== "START")   //If the Drop Down selected value is Enable
{
  $("#div1").show(); //Making the Input Box visible 
  $("#div2").hide();
}else{
  $("#div1").hide(); //Making the Input box element hidden
  $("#div2").show();
};

Upvotes: 1

Related Questions