• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Can I create a input field in a form that behaves like a...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 13792
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can I create a input field in a form that behaves like a password field?

Tshun Kiat
Tshun Kiat over 11 years ago

Dear Gurus,

 

Tried to Google and search in the forum on this topic but turn up nothing.

I'm trying to create a field in a form that allows user to enter a password that will be parsed to an external script.

Is there a way to make what they type in the password field to appear in asterisks on the form, e.g. ******

Please advise or recommend a better solution to handle this. Maybe there is a better way to parse credentials to external scripts in a more secure manner?

Thanks in advance.

Best regards,

TTK 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 11 years ago

    I wrote this a few years ago to try out the idea. It's not really very secure though - see the comments at the top.

    Andrew.

    /* abExamplePasswordForm.il
    
    Author     A.D.Beckett
    Group      Custom IC (UK), Cadence Design Systems Ltd.
    Language   SKILL
    Date       Feb 05, 2010 
    Modified   
    By         
    
    Attempt at a password field (displays * for each typed character). 
    Has some problems:
    
    1. The typed characters do actually appear in the CDS.log file
    2. Will sort of tolerate typing in "*" but if you paste * over an existing
       displayed *, it won't work.
    3. If you click in the middle of the row of stars, and delete, it deletes off
       the end (because it doesn't know where you deleted)
    4. If you click in the middle of the row of stars, and type a character,
       it will end up storing stars after the newly typed in character.
    
    At the end you can access form->password->realValue to access the
    actual field. 
    
    For normally typed in and deleted characters, should behave fine. Because
    it's in the CDS.log though, don't use for high security applications!
    Might also be worth setting hiSetFilter to stop everything being echoed
    in the CIW.
    
    ***************************************************
    
    SCCS Info: @(#) abExamplePasswordForm.il 02/05/10.16:54:54 1.1
    
    */
    
    /***************************************************************
    *                                                              *
    *    (abPasswordModifyCallback field newValue programmatic)    *
    *                                                              *
    *  The modify callback for the password field. Tries to hide   *
    * the value entered with stars. Not perfect (see notes at the  *
    *                            top).                             *
    *                                                              *
    ***************************************************************/
    
    (defun abPasswordModifyCallback (field newValue programmatic)
      (let (realValue realLen newLen formField starCount)
        ;--------------------------------------------------------------------
        ; Only trigger this if the field was changed by typing in the
        ; form
        ;--------------------------------------------------------------------
        (if programmatic
          (progn
            (setq formField (get (hiGetCurrentForm) field))
            (setq realValue (or (getq formField realValue) ""))
            (setq realLen (strlen realValue))
            (setq newLen (strlen newValue))
            ;----------------------------------------------------------------
            ; Count how many stars there are already in the form field
            ;----------------------------------------------------------------
            (setq starCount 0)
            (forall char (parseString newValue "")
                    (and (equal char "*") (postincrement starCount)))
            (cond
              ;--------------------------------------------------------------
              ; If everything is still stars, but there are fewer than
              ; previously, assume the end was deleted
              ;--------------------------------------------------------------
              ((and (equal starCount newLen)
                    (lessp newLen realLen))
               (setq realValue (substring realValue 1 newLen))
               )
              ;--------------------------------------------------------------
              ; If the number of stars is less than or equal to before,
              ; add on the piece after the last sequential star to the 
              ; real value
              ;--------------------------------------------------------------
              ((leqp starCount realLen)
               (setq realValue (strcat
                                 (or (substring realValue 1 starCount) "")
                                 (or (substring newValue (add1 starCount)) "")
                                 )))
              ;--------------------------------------------------------------
              ; Otherwise just add on the new part on the end
              ;--------------------------------------------------------------
              (t
                (setq realValue (strcat realValue
                                        (or (substring newValue (add1 realLen)) "")
                                        )))
              )
            ;----------------------------------------------------------------
            ; Produce a string of stars
            ;----------------------------------------------------------------
            (setq newValue "")
            (for i 1 (strlen realValue)
                 (setq newValue (strcat "*" newValue)))
            ;----------------------------------------------------------------
            ; Store the real value on the form field
            ;----------------------------------------------------------------
            (putpropq formField realValue realValue)
            newValue
            )
          t
          ) ; if
        ) ; let
      ) ; defun
    
    /***************************************************************
    *                                                              *
    *                   (abExamplePasswordForm)                    *
    *                                                              *
    *     Create an example form which has a "password" field      *
    *                            on it.                            *
    *                                                              *
    ***************************************************************/
    
    (defun abExamplePasswordForm ()
      (let (password)
        (setq password
              (hiCreateStringField
                ?name 'password 
                ?modifyCallback "abPasswordModifyCallback"  
                ?prompt "Password"))
        (hiCreateAppForm
          ?name 'abPasswordForm
          ?fields (list password)
          ?callback 'abPasswordFormCB
          )
        (hiDisplayForm abPasswordForm)
        )
      )
    
    /***************************************************************
    *                                                              *
    *                   (abPasswordFormCB form)                    *
    *                                                              *
    *            Callback for the example password form            *
    *                                                              *
    ***************************************************************/
    
    (defun abPasswordFormCB (form)
      (printf "Password entered was: %L"
              (getq (getq form password) realValue)
              )
      )

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Tshun Kiat
    Tshun Kiat over 11 years ago

     Andrew,

     

    Thanks for sharing. Much appreciated.

     

    Regards,

    --

    TTK

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • tweeks
    tweeks over 11 years ago
    Another solution would be to open an xterm running an appropriate script.
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Tshun Kiat
    Tshun Kiat over 11 years ago

     Thanks Tom!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information