verify contents of text box - InfoPath Dev
in

InfoPath Dev

verify contents of text box

Last post 08-11-2006 08:27 PM by Shiraz Cupala. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-10-2006 03:09 AM

    verify contents of text box

    Hi

    I have a very simple infopath form in which the user types in their name and id number which then concats and shows them their user name in another text box. I would like to have a button behind which the code would take the string produced in this box and search a separate excel sheet containing the pre-setup usernames in separate cells.

    If a match is found in the spreadsheet, a message saying "success" or "fail" is shown to the infopath user.

    Does anyone have an idea of a script I can use please?

    thanks alot
    Dan
  • 08-10-2006 02:23 PM In reply to

    Re: verify contents of text box

    Hello and welcome to our forum. This is a bit tricky because you woudl have to crack open the Excel XLS file and extract the data. Is there a specific reason why you must have that list in Excel? Could this be just a separate lookup XML file? That would make it fully codeless actually. You can actually easily output your Excel spreadsheet to an XML file using the Excel XML map feature. Then in InfoPath you just create a seconday data connection to query that XML and write data validation or rules to do your lookup and message.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-11-2006 01:13 AM In reply to

    Re: verify contents of text box

    Thanks for that Shiraz,
    I have converted to xml and have added it as secondary connection. One thing: I have the output from the username box copying itself to an mdb which is used as a record to show that new users have agreed to the Computer Usage Policy form. Can this box be bound to the main connection (the mdb) and a secondary connection (the xml) or would I have to use another box to bind to the xml and do the data validation?
    Thanks
    Dan
  • 08-11-2006 06:20 AM In reply to

    Re: verify contents of text box

    I agree with Shiraz that you probably want this list in a shared location, such as a SharePoint List, a database, or maybe even an outside XML doc.

    To check to see if the username exists in the 2DS you can just do something like this:

    1. Place two expression boxes under the button, one says Success, the other Failure.
    2. Put conditional formatting on them so that if they username is found, Succes displays and Failure doesn't. Vice versa if it's not found.

    To do the checking to see if it exists you can do something like this:

    count( XPath/To/Node/on/Secondary[ MainDOM/theUserId = ./UserId ) = 0

    I hope this helps!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 08-11-2006 08:27 PM In reply to

    Re: verify contents of text box

    You can't bind a node to two different nodes. However, you can bind the control to your main data source node, then set a rule on that node to also copy it's value to the secondary datasource node. It achieves the nearly same result.
    Shiraz Cupala / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.