Limit the number of decimals a user can enter - InfoPath Dev
in

InfoPath Dev

Limit the number of decimals a user can enter

Last post 04-03-2012 03:56 AM by Jo-Anne Alfafara. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-03-2012 01:44 AM

    • eliasen
    • Top 500 Contributor
      Male
    • Joined on 10-07-2010
    • Aalborg, Denmark
    • Posts 33

    Limit the number of decimals a user can enter

    Hi all

     InfoPath 2007 running on Forms Server 2007.

    I know how to use the formatting options of a TextBox in order to only show for instance 2 decimals. But I need the data source to only contain two decimals and not just the view of the datasource. I can then use the function "round" in a rule to round to two decimals, but my customer prefers it if the user simpyl cannot enter more than two decimals in the textbox. The user will then have to round herself in case of a number with 3 decimals.

     Is there anyway I can limit the number of decimals entered to only 2?

    Thanks

    eliasen, representing himself and not the company he works for.
    Microsoft BizTalk MVP
    Blog: http://blogs.eliasen.dk/technical/
  • 04-03-2012 02:38 AM In reply to

    Re: Limit the number of decimals a user can enter

    Hi eliasen,

    Sorry I'm a little confused when you said "I need the data source to only contain two decimals and not just the view of the datasource". The value of your text box in the view should be the same thing stored as value in your data source, no?

    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
  • 04-03-2012 02:56 AM In reply to

    Re: Limit the number of decimals a user can enter

    Hello eliasen,

    The best option I can think of is to place conditional validation on the fields, so that the user will get a validation error if they enter more than 2 decimal places.  Something like string-length(substring-after(., '.')) > 2 should probably do the trick.  Would that work for you?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 04-03-2012 03:03 AM In reply to

    Re: Limit the number of decimals a user can enter

    Nice Jimmy!
    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
  • 04-03-2012 03:44 AM In reply to

    • eliasen
    • Top 500 Contributor
      Male
    • Joined on 10-07-2010
    • Aalborg, Denmark
    • Posts 33

    Re: Limit the number of decimals a user can enter

    Jo-Anne Alfafara:

    Sorry I'm a little confused when you said "I need the data source to only contain two decimals and not just the view of the datasource". The value of your text box in the view should be the same thing stored as value in your data source, no?

    Hi, and thank you for your answer.

    No, the value shown in the text box isn't the same as the value in the data source. The value in the data source can be 23.456 but I can choose in the properties for the Textbox to only show to decimals.

     

    eliasen, representing himself and not the company he works for.
    Microsoft BizTalk MVP
    Blog: http://blogs.eliasen.dk/technical/
  • 04-03-2012 03:47 AM In reply to

    • eliasen
    • Top 500 Contributor
      Male
    • Joined on 10-07-2010
    • Aalborg, Denmark
    • Posts 33

    Re: Limit the number of decimals a user can enter

    Hi

    Thanks for the idea - it won't help me though. The requirement is simply not allow the user to enter the third decimal and not provide an error if she should do so.

    I don't think it is doable...

    Thanks

    eliasen, representing himself and not the company he works for.
    Microsoft BizTalk MVP
    Blog: http://blogs.eliasen.dk/technical/
  • 04-03-2012 03:48 AM In reply to

    Re: Limit the number of decimals a user can enter

    I see - can you try Jimmy's suggestion above? Thanks!
    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
  • 04-03-2012 03:56 AM In reply to

    Re: Limit the number of decimals a user can enter

    Sorry - didn't see your reply above. Anyway, hope you'll find a workaround!
    Jo-Anne Alfafara
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™
Page 1 of 1 (8 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.