Prevent any formatting on textbox - InfoPath Dev
in

InfoPath Dev

Prevent any formatting on textbox

Last post 09-28-2016 07:17 AM by arkainus. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 09-28-2016 07:17 AM

    Prevent any formatting on textbox

    I'm not sure if this is even possible, but I figured I'd ask and see if anyone has a solution for this.

    I have a form, that I've hooked in via code to search an SQL Table for a product that we use on-site. This SQL table is from a vendor, so I cannot modify that structure without risk of breaking something in the program that utilizes it. The table I search has contacts in it, each contact has a primary key associated with it (in this case, dubbed "event_code") Event_code is varchar(7), and they've utilized some sql triggers to increment a counter for each new contact that gets added. Their triggers prepend white space for event_code's shorter than 7 characters (i.e. event_code 10883 is saved in the database as ' 10883'. I've implemented the functionality so that each result gets populated into a repeating table. From there, they have an ability to check a box on that repeating table row, and I've implemented a button that will do some logic based on their selections, and copy info from the sql table into the form (and insert rows into a different database automatically). This works great if the event_code is exactly 7 characters, not so good on the older contacts from 20+ years ago that we still do business with that have the shorter codes.

    The tricky thing is an infopath textbox field seems to strip leading whitespaces on the textbox once focus has been shifted from the field, so I can never get the value of the textbox to be ' 10883'. Is there a way to prevent this? A way to keep the verbatim entry? My trusty google searches have so far turned up bupkis - results are mostly for people asking how to prevent whitespace in a textbox. I suppose I can implement in my code string.length checks, and prepend the white space manually based on the returned length, but I was just hoping there's something super easy that I've missed. As always, any insight/help here would be greatly appreciated!

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