Splunk Search

how can i change inputtext: text to password

uppukumar
Explorer

hi,

i try to change the type of an inputtext : from text to password

Used Jquery
$("[id^=my_field]").attr('type','number')

But not working in latest splunk 7.2.4

Tags (1)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Try this

<form script="password.js">
  <label>password</label>
  <fieldset submitButton="false">
    <input type="text" token="field1" id="test">
      <label>field1</label>
    </input>
  </fieldset>
</form>

js:

require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!",
], function(mvc) {
    $(document).ready(function () {
         $('#test [data-test="textbox"]').attr('type','password');
     });
});

View solution in original post

vnravikumar
Champion

Hi

Try this

<form script="password.js">
  <label>password</label>
  <fieldset submitButton="false">
    <input type="text" token="field1" id="test">
      <label>field1</label>
    </input>
  </fieldset>
</form>

js:

require([
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/ready!",
], function(mvc) {
    $(document).ready(function () {
         $('#test [data-test="textbox"]').attr('type','password');
     });
});

ldongradi_splun
Splunk Employee
Splunk Employee

As you used #test, it's only valid for 1 text box.
The js function can receive several definitions, like :

    $('#password1 [data-test="textbox"]').attr('type','password');
$('#password2 [data-test="textbox"]').attr('type','password');
$('#password3 [data-test="textbox"]').attr('type','password');

and all the text boxes needing password protection from the xml would use:

    id="password1"
id="password2"
id="password3"

uppukumar
Explorer

hi,

i try to change the type of an inputtext : from text to password

Used Jquery
$("[id^=my_field]").attr('type','number')

But not working in latest splunk 7.2.4

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...