Infopath: Restricting alphanumeric values in a text field - InfoPath Dev
in

InfoPath Dev

Infopath: Restricting alphanumeric values in a text field

Last post 11-10-2008 10:48 AM by sind2008. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 11-08-2008 09:54 AM

    Infopath: Restricting alphanumeric values in a text field

    I am using Infopath 2003 SP2 to build a form. I need help on how to restrict only numbers on a data entry field. Like input mask in MS access. I am using Jscript to calculate totals using this field that time I am getting a runtime error if user enters a alphanumeric ( e.g. 40K) and asking  Do you want to Debug? I don’t want this Run time error show, what I need to do? Thank you in advance for your  help.

    Filed under:
  • 11-08-2008 09:29 PM In reply to

    Re: Infopath: Restricting alphanumeric values in a text field

    You can check whether the number is a valid number and if it's not, skip the calculation and show the user an error.

    It would be easier to give you a more specific answer if you would show us the part of your code that is causing the error.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 11-09-2008 07:36 AM In reply to

    Re: Infopath: Restricting alphanumeric values in a text field

    Jimmy,

    Thank you so much for your response.  I want to allow only Numbers in a text field. The issue is if the users enters alphanumeric(e.g 100k), I will get a runtime error, due to the non-numeric value in a evaluate expression.    I am using JScript to calculate a %.   I don't want to allow user to enter alphanumeric values.

    Thanks

    Sind

  • 11-09-2008 10:25 PM In reply to

    Re: Infopath: Restricting alphanumeric values in a text field

    Hi Sind,

    You can change the data type of that field to integer. So that it can accept only integer values. Another way is adding a validation for the control by using custom patterns. The condition should be like ‘not(xdUtil:Match(string(.), "\d*"))’ .

    Swathip
    www.ggktech.com
  • 11-10-2008 10:48 AM In reply to

    Re: Infopath: Restricting alphanumeric values in a text field

    Thankyou very much for helping  me!. This is the code worked for me.

    XDocument.Util.Match(xmlDom.selectSingleNode("//my:Ans210").text, "\\d*")

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.