[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 661
  • Last Modified:

Java Script textbox properties!!

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"

      ELSE
           FORM1.txtInspectorName.value = BioPlugInActX.Result
      end if
      End Sub
</script>

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.
0
phil301
Asked:
phil301
  • 2
1 Solution
 
rbadaroCommented:
Hi.

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.
0
 
wtconwayCommented:
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.
0
 
phil301Author Commented:
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.
0
 
wtconwayCommented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now