We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Java Script textbox properties!!

phil301 asked
Medium Priority
Last Modified: 2012-06-21
I am attempting to write a page that uses an encrypted finger print reader for secure access. I am using the following JavaScript to read in the value:

 <input type = "Button"  name="FINGER" value="SIGN IN" id="Button1"  language = "javascript" onclick="return Button1_onclick()"  />

script language="vbScript">

      // Identify using two fingers, three scans each
      Sub FINGER_OnClick
            BioPlugInActX.IdentifyQuick "0"
      End Sub

      Sub BioPlugInActX_OnIdentify
      If BioPlugInActX.Result = 000000000 then
      Form1.txtID.value = "ID NOT FOUND"
      BioPlugInActX.IdentifyQuick "0"

      ELSEIF BioPlugInActX.Result = "BADSCAN" then
         Form1.txtID.value = "BAD SCAN, RETRY!"
         BioPlugInActX.IdentifyQuick "0"

      ElseIF BioplugInActX.Result = -1 then
         Form1.txtID.value = "BAD SCAN RETRY!"
      BioPlugInActX.IdentifyQuick "0"

           FORM1.txtInspectorName.value = BioPlugInActX.Result
      end if
      End Sub

The value from the reader is passed to the textbox fine. The problem I have, is if I make the textbox secure by using "readonly", ASP just sees the value as an empty string, even though I can see it written in the textbox. If I unsecure the box, then asp passes the value.

How can I secure the textbox and still have the value passed. Thanks.
Watch Question


One solution would be to set the readonly property to trye before setting the value and setting it to false after setting the textbox value. In your case, put the code at the begining and end of the BioPlugInActX_OnIdentify Sub.

If modifying the readonly to true doesn't quite help the situation you could always try shifting the focus to another control once the textbox receives focus. For example:

<asp:TextBox ID="txtID" Runat="Server" OnFocus="FINGER.focus()"/>

the OnFocus handler will run at the client side and shift the focus to another control. No clue if VBScript will force focus on the object to modify it's value, but you could try it.


Thanks for the reply. I am new to JavaScript, can you explain your code (<asp:TextBox ID="txtID" Runat="Server" OnFocus="FINGER.focus()"/>) a little further. I understand the concept of what you are saying, just not the Java. Is FINGER.focus a textbox in my form? Do I have to write code in the handler? I simply inserted the OnFocus=CollarSn() into my form, and it did nothing.

Thanks in advance.
No problem. FINGER is the name of the button you had listed in your code in your first post. So if you give the button or textfield or dropdownlist or any input object a name you can use the focus() method to switch input to that control. The best site to visit to learn more about what methods and properties are available in javascript is http://msdn.microsoft.com/library/default.asp?url=/workshop/author/html/reference/elements.asp 

You'll find loads of information on each HTML tag. The onFocus handler basically says, once the cursor is in the textbox, move the cursor to the button named FINGER. But you can do all kinds of stuff with JavaScript, to play around with it, see what works out best.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.