Field MUST contain a set number of characters - InfoPath Dev
in

InfoPath Dev

Field MUST contain a set number of characters

Last post 08-19-2013 06:31 AM by RegolithDev. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 08-12-2013 02:17 PM

    • Zeb Ahmed
    • Not Ranked
    • Joined on 03-03-2013
    • Auckland, New Zealand
    • Posts 4

    Field MUST contain a set number of characters

    Hi all,

    I have four fields that when concatenated together create a bank number.

    Each field MUST have a set amount of numbers in them e.g. 12-1234-1234567-123

    So:

    Field1 must have 2 numbers

    Field2 must have 4 numbers

    and so on...

    Question is, how can I make this happen? The numbers can change. They MUST be numbers (not text.) I have already set each field to their max limit, but how do I enforce that max limit?

    Thanks.

  • 08-12-2013 09:53 PM In reply to

    Re: Field MUST contain a set number of characters

    How about a validation rule?

    Patrick Halstead
    Project Manager at Qdabra
  • 08-13-2013 11:59 AM In reply to

    • Zeb Ahmed
    • Not Ranked
    • Joined on 03-03-2013
    • Auckland, New Zealand
    • Posts 4

    Re: Field MUST contain a set number of characters

    Hi Patrick,

    a validation rule makes sense, but HOW exactly would you do it? What are the settings for ensuring people enter in TWO numbers in the box? I've read that a pattern might do it but I've never used patterns before so I'm clueless on how to make this happen.

  • 08-13-2013 02:31 PM In reply to

    Re: Field MUST contain a set number of characters

    You can do this with formatting rules, more information available here http://office.microsoft.com/en-nz/infopath-help/add-formatting-rules-HA101783371.aspx

    Specifically the Data Entry Patterns section of this article.

    Use the 'matches pattern' or 'does not match pattern' on the text-box control to format it (text or background colour), on another text-box control to show as an error message or to disable the submit button on the page until the pattern matches.

    For example: The rule condition would be... Field1 => Does not match pattern => Custom pattern \d\d (for two digits)

    Bevan Stratton
  • 08-13-2013 04:31 PM In reply to

    • Zeb Ahmed
    • Not Ranked
    • Joined on 03-03-2013
    • Auckland, New Zealand
    • Posts 4

    Re: Field MUST contain a set number of characters

    Thanks Bevan, that worked for me! Really appreciate the example as well as it helped me visualise what I needed to do :)
  • 08-18-2013 05:29 PM In reply to

    Re: Field MUST contain a set number of characters

    Yay, way to go Bevan.

    You're batting 1000. :)

    Patrick Halstead
    Project Manager at Qdabra
  • 08-19-2013 06:31 AM In reply to

    Re: Field MUST contain a set number of characters

    If the fields are text boxes why not just have them self limit to a certain number of characters?

    The text box limit can be accessed by selecting the field-->Properties-->Control Properties-->Display Tab-->  Near the bottom of the dialog box there is a checkbox to "limit text box to" n-Characters.  Try that.  Might be easier than trying to match a pattern.  Unless you want the fields to be able to enter more characters than necessary for security reasons, in which case, you would have to use the pattern method.

     

    Chris
    Regolith Inc.
    www.regolithinc.com

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