Passing a Javascript value to a Document Property

If I don't have the Javascript API installed, you can assign a javascript value to a Document Property by  using a (hidden) Property Control:

html:
<div id='mySpotfireControl' style='display:none'><spotfireControl id=abc..../></div>

jscript:
//pass javascript property to Property Control
document.getElementById('mySpotfireControl').firstChild.value = myJSObject.property

//same as clicking enter on the input after entering a value on the Property Control
$("#mySpotfireControl input").focus()
$("#mySpotfireControl input").blur()





To pass a javascript value to a multiple line input document property


html

<div id='docPropTarget' style='display:none'>
   <SpotfireControl id="a964447a03cc4b87b6e6495738edb9f6" />
</div>
<br/>
<textarea id='jsValue' >javascript value goes here</textarea>
<div id='btn'>click here to pass js value to doc property</div>



js
$("#btn").button().on('click',function(){
val = $("#jsValue").text()
$("#docPropTarget textarea").text(val).focus().blur()
})


5 comments:

Gunasekaran A said...

what is myJSObject in above script

Jose Leviaguirre said...

myJSOObject refrest to an hypotetical jason object with a property to illustrate how a havascript value can be passed to a spotfire document property.

myJSObject could be Math.PI, a javascript function call that returns something or a custom javascript object For example:

myJSObject = {property1:"value1",property2:"value2"}
myJSObject.property1 //returns "value1"

Cezar Nicolescu said...

I used the combination of js and jquery in a function passed to a button click event but while in the client app it wroks fine, in the webplayer it crashes with an "interpretation error" and i am quite sure it is because of jquery part of the code:

here is my function:

riskSubmit.onclick = function(){
document.getElementById("hiddenRisk").firstChild.value = document.getElementById("riskarea").value;
$("#hiddenRisk input").focus()
$("#hiddenRisk input").blur()
}

Am I doing anything wrong?

Bhoobalan R said...

how to update input field multiple lines using the same . guess there should be some modification done to scripts .

Jose Leviaguirre said...

Interpretation error most of the times means a javascript error, but I believe it was a bug. I haven't seen it in 7.5+