Pass Javascript Values to Document Properties

Spotfire Input Control linked to 'myDocProperty':
<span id='spotfireInputWrapper'>
<SpotfireControl id="c5314cd0a5cc466eb0e55f5e463ec324" />

Spotfire Label displaying current 'myDocProperty' value:
<SpotfireControl id="79f728c3651f4ee1bcc10f68732954f8" />

html input
<INPUT id="htmlInput" value='hello'/>
html button that triggers javascript:
<SPAN id=ok>ok</SPAN> 


//javascript function that transfers html input value to spotfire input property control
 var jsValue = $('#htmlInput').val()
$('#spotfireInputWrapper input').val(jsValue).blur()

Here is an example:

#switchImageButton {
    background-image: url("");
    height: 300px;
    width: 178px;
    background-repeat: no-repeat;
    background-position-x: -173px;

<div id='sfDocProp'>
'switchStatus' Document Property: <SpotfireControl id="sw17ch57a7u55p0tf1r3d0cum3n7p4093r7y" />

<div id='switchImageButton'></div>

function setOnOff(){
//check if css position is showing the on image
var isOn  = $("#switchImageButton").css("background-position-x")=="-173px"

//toggle image portion
var pos = isOn?"-10px":"-173px"

//update spotfire (boolean) doc prop
$('#sfDocProp input').val(isOn).blur()


No comments: