Date Posted:
Product: TIBCO Spotfire®
Product: TIBCO Spotfire®
Problem:
How to mask the characters in an Input Field property control in Text Area
Solution:
There may be scenarios where you would want to take input from a user and also would like to mask their input in the Input Field Property control added to an Text Area like when capturing user's password. There is no out of the box configuration available to mask the characters
A workaround would be to add a JavaScript to the text area which changes the type attribute of this property control's HTML to type 'password' so that it will be masked.
Steps:
1. Wrap your Spotfire property control with a DIV tag. For example:
<div id ="pwd"> <SpotfireControl id="abb633ddcb554653abc7dc14ce0e09de" /> </div>2. Add the following JavaScript which will change the type of input field from 'text' to 'password' (based on the "id" value of "pwd")
$(document).ready(function() { if(!document.readyFlag) { $("#pwd input").attr('type','password'); document.readyFlag=true; } });
NOTE:
As a general rule the JavaScript should only modify elements in the HTML code that you have created and have control over yourself. This means that the JavaScript should only change parts of the HTML DOM that reside in the Text Area and that is defined in the the HTML of the Text Area
Please note that TIBCO does not guarantee that JavaScripts that were developed for a specific Spotfire version will work across all the upgraded/latest versions. With every release, there is a higher chance of the underlying implementation of Spotfire elements being changed compared to its predecessors. It's important to note that HTML will not be the same between releases.
There is no guarantee that things will look and behave the same in a later release, so JavaScripts always needs to be checked (and revised/redesigned) for every release. Wiki: Best Practices for writing custom Java Scripts
Comments
0 comments
Article is closed for comments.