title: jenkins - create dynamic textbox and passwords when checkbox or filed is used
body: <p>i want to have checkbox/single select , when user checked the checkbox/use the filed in the single select , it will create dynamically few text box(5).2 of those text box should contain password/keys (so should be encrypted /not shown in jenkins parameters.</p>
  <p>i tried with Active Choices Parameter and Active Choices Reactive Reference Parameter from jenkins file and from gui</p>
  <p>example:</p>
  <p>i have parameters :</p>
  <pre><code>Active Choices Parameter
  name: use_custom
  Groovy Script:  return [&quot;true&quot;, &quot;false&quot;]
  Choice Type: single select
  
  Active Choices Reactive Reference Parameter
  name: custom_values
  </code></pre>
  <p>Groovy Script:</p>
  <pre><code>myPassword = ''
  
  if ( use_custom == &quot;true&quot;) {
  
    return &quot;&quot;&quot;
  
                      inputBox=&quot;&lt;input class='setting-input' name='value' type='password' value=''&gt;&quot;
                      inputBox=&quot;&lt;input class='setting-input' name='value' type='text' value=''&gt;&quot;
  
  
  &quot;&quot;&quot;
  
   echo(text1)
  
  
                      
  
  }
  else {
   return &quot;&quot;
  }
  </code></pre>
  <p>Choice Type: formatted html ,
  Referenced parameters: use_custom</p>
  <p>i created 2 dynamic html box (work only for text box , not passwords/key that <strong>user need to enter manually (not via jenkins cred)</strong></p>
  <p>example output in parameters:
  custom_values: 1234,11</p>
  <p>*it show the password in jenkins params (free text)</p>
  <p>what is the solution to allow user to write password and text box ( 2 pass, 3 box) when another field is true (password cannot be free text)</p>
  <p>groovy pipeline example(in case of Env:dev , create 2 textbox):</p>
  <pre><code>properties([
      parameters([
          [$class: 'ChoiceParameter', 
              choiceType: 'PT_SINGLE_SELECT', 
              description: 'Select the Env Name from the Dropdown List', 
              filterLength: 1, 
              filterable: true, 
              name: 'Env', 
              randomName: 'choice-parameter-5631314439613978', 
              script: [
                  $class: 'GroovyScript', 
                  fallbackScript: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          'return[\'Could not get Env\']'
                  ], 
                  script: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          'return[&quot;Dev&quot;,&quot;QA&quot;,&quot;Stage&quot;,&quot;Prod&quot;]'
                  ]
              ]
          ], 
          
          
          // [$class: 'CascadeChoiceParameter', 
          //     choiceType: 'ET_FORMATTED_HTML', 
          //     description: 'Select the Server from the Dropdown List', 
          //     filterLength: 1, 
          //     filterable: true, 
          //     name: 'Server', 
          //     randomName: 'choice-parameter-5631314456178619', 
          //     referencedParameters: 'Env', 
          
          [$class: 'DynamicReferenceParameter',
          choiceType: 'ET_FORMATTED_HTML',
          omitValueField: true,
          description: '123',
          name: 'Server',
          randomName: 'choice-parameter-5631314456178624',
          referencedParameters: 'Env',
              script: [
                  $class: 'GroovyScript', 
                  fallbackScript: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          'return[\'Could not get Environment from Env Param\']'
                  ], 
                  script: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          ''' if (Env.equals(&quot;Dev&quot;)){
                          inputBox2 = &quot;&lt;input name='value' class='setting-input' type='text'&gt;&quot;
                          inputBox = &quot;password(name: 'KEY', description: 'Encryption key')&quot;
  
                          
  
  return[inputBox]                          
  }
  else {
   return &quot;&quot;
  }
                          '''
                  ]
              ]
          ],
          
          
          [$class: 'DynamicReferenceParameter',
          choiceType: 'ET_FORMATTED_HTML',
          omitValueField: true,
          description: '1234',
          name: 'pass',
          //randomName: 'choice-parameter-5631314456178624',
          referencedParameters: 'Env',
              script: [
                  $class: 'GroovyScript', 
                  fallbackScript: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          'return[\'Could not get Environment from Env Param\']'
                  ], 
                  script: [
                      classpath: [], 
                      sandbox: false, 
                      script: 
                          ''' if (Env.equals(&quot;Dev&quot;)){
                          inputBox = &quot;&lt;input name='value' class='setting-input' type='password'&gt;&quot;
  
  return[inputBox]                          
  }
  else {
   return &quot;&quot;
  }
                          '''
                  ]
              ]
          ]
          
  
          
          
      ])
  ])
  
  pipeline {
    environment {
           vari = &quot;&quot;
    }
    agent any
    stages {
        stage (&quot;Example&quot;) {
          steps {
           script{
            echo 'Hello'
            echo &quot;${params.Env}&quot;
            echo &quot;${params.Server}&quot;
          echo &quot;${params.pass}&quot;
  
            if (params.Server.equals(&quot;Could not get Environment from Env Param&quot;)) {
                echo &quot;Must be the first build after Pipeline deployment.  Aborting the build&quot;
                currentBuild.result = 'ABORTED'
                return
            }
            echo &quot;Crossed param validation&quot;
          } }
        }
    }
  }
  </code></pre>
  <p>i tried also with mask_plugin , it mask from console output , not from parameters , any ideas ?
  thanks</p>