TextBox Data type "Time" fails validation on concat() assembled hh:mm string - InfoPath Dev
in

InfoPath Dev

TextBox Data type "Time" fails validation on concat() assembled hh:mm string

Last post 01-11-2013 03:55 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-11-2013 01:14 PM

    TextBox Data type "Time" fails validation on concat() assembled hh:mm string

    IP 2010. Text Box with a data type of "time" .

    If user types 945 the box sits there "red" because it needs a colon.   OK, customer says, can you "stick" a colon in for my lazy users?  Sure I say.   Why not?

    Well, I put a couple of rules together that run when a colon is missing (one for 3 digit and one for 4 digit using regex pattern matches \d\d\d or \d\d\d\d respectively).  Great, no problem so far, the rule absolutely fires on 0345, for example.

    Here's the Set Field's Value fx:

    concat(0, substring(., 1, string-length(.) - 2), ":", substring(., string-length(.) - 1, 2))

     Turns 345 into 03:45.  But the datatype validation is failing; leaves it "red".   If I type in the box, backspace over the last digit & retype it effectively not changing the string ONE LITTLE BIT the datatype validation passes muster.

     I've tried number() around all the substrings, no joy.  I don't see any "time()" converter.....very annoying.  

    Suggestions? (besides "no, your lazy users are just gonna have to type a colon you unreasonable customer you") ;-)

     

     

  • 01-11-2013 03:55 PM In reply to

    Re: TextBox Data type "Time" fails validation on concat() assembled hh:mm string

    The time format is actually hh:mm:ss. Save an XML file from your form and open in a text editor to see the real value of the field, or right click your text box (in design mode), select properties, click the format button, and select the None (display XML value) so you can see the actual value... When you retype it, IP is adding the :00 for the seconds...

    Hilary Stoupa

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