Hide Section until query has been made? Lock Section? - InfoPath Dev
in

InfoPath Dev

Hide Section until query has been made? Lock Section?

Last post 02-14-2011 08:37 AM by Max M. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-10-2011 05:40 AM

    • Max M
    • Not Ranked
    • Joined on 02-10-2011
    • Posts 9

    Hide Section until query has been made? Lock Section?

    Hi Guys, I'm new to InfoPath and I have a couple questions. The first one is about how to hide a section until a query has been made. I also want to make it so that the repeating section adds only one new record, and cannot be accidentally deleted by the user once they've created it.

     Basically I've got an access database on a network drive of employee info in one table, and another table with fields for responses to a questionnaire ready to be input. I created an infopath form, following a tutorial from Microsoft, which allows the user to query their data by typing in their name and hitting a query button, and then their info appears in a repeating section below, with a sub-repeating section for all of their survey responses. So far, it works well and the user can successfully add responses which will be added to the response table and the employee primary key field is also added to identify who input the response based on their lookup.

     The problem is that they can see all the questions in the section below the lookup before they lookup their name, and if someone were to answer the questions and hit submit without looking up their name, then they get an error, and would have to start all over. I would like to somehow hide the repeating section with the responses until they query their name and their info pops up.

     Also, when they click outside of a text box in the repeating section, it selects the entire selection and they could accidentally hit delete and lose all of their answers.

     Finally, I would like to hide the "add new section" link once their survey pops up. Basically I want to restrict the number of records they can add to 1.

     Any help is greatly appreciated.

     Thanks,

    Max

  • 02-10-2011 08:57 AM In reply to

    Re: Hide Section until query has been made? Lock Section?

    Hi, Max, and welcome!

    Let's see. When they look up their name, they are filling out query fields, right? Can you hide the data section if those fields are blank? I haven't worked with a database bound form in a while, so I can't recall if querying clears the query fields after the query is performed....

    I think you don't want to show the "Add new section" link at all, do you? Since they query on their name to get their questions? They wouldn't be using that, would they? If so, it seems that you could just disable the ability for the user to add or remove a section for that repeating group (under the control's properties).

    Hilary Stoupa

  • 02-10-2011 09:40 AM In reply to

    • Max M
    • Not Ranked
    • Joined on 02-10-2011
    • Posts 9

    Re: Hide Section until query has been made? Lock Section?

    Thanks so much for your response, Hilary!  I hope you can help me out.

     Yes, the first set of input boxes are query fields, where the user is instructed to type their name and then hit the query button, which says "Lookup your Info". Once the user queries their info then the info data field shows their info, and the response data section is then hidden with a link to add a new section, which I renamed "Click here to begin survey", because adding a new response section will create their new response record with their info already associated with it after completing the query.

    However, when the form is first opened, the data fields below the query are already showing, but blank. I'd like to hide these fields until they complete the query. (I hope you understand what I mean).

    When I try to disable adding and removing a section in the properties, then the questions don't come up at all with no apparent way to add them.

    Here is a link to the tutorial that I followed to set up my form: http://office.microsoft.com/en-us/infopath-help/how-to-guide-connecting-an-infopath-form-to-an-access-database-HA001119950.aspx?CTT=5&origin=HA001103247  (I know that it's for Infopath 2003 and I am using 2007, but its the best one I could find for what I wanted to do.)

     I also originally wanted to move this onto the web via sharepoint, but I think that may be beyond my abilities at this point. Because of my deadline on this project, I think that sharing the form over the network will be okay.

  • 02-10-2011 09:50 AM In reply to

    Re: Hide Section until query has been made? Lock Section?

    I think I'd add another field (True / False, default to false) and add a rule to my button that I'm using for my query to set that field to True -- then you could hide your data fields section if that field was not equal to true.

    I'm kind of perplexed that the questions won't show if adding / removing is disabled. However, you could always add conditional formatting on the section such that if any of the questions have been answered the user can't add / delete the section. Would that work?

    Hilary Stoupa

  • 02-14-2011 08:37 AM In reply to

    • Max M
    • Not Ranked
    • Joined on 02-10-2011
    • Posts 9

    Re: Hide Section until query has been made? Lock Section?

    Hilary Stoupa:

    I think I'd add another field (True / False, default to false) and add a rule to my button that I'm using for my query to set that field to True -- then you could hide your data fields section if that field was not equal to true.

    Success on one of the things that I needed!! I was able to hide the questionnaire until the user looks up their info by adding a conditional formatting on the section that is set to hide when employeeID is blank. I used the same rule to hide the submit button as well. Now they must lookup their info before the questionnaire pops up.

    Okay, now I just need to make it hide the "new section" link so that it only lets each user add one new section at a time.  I also want it to not allow users to delete the section once they've started filling out responses. And not to highlight the entire section blue when it is first added, but instead just put the cursor at the first response field.

     I think some of the info in this other thread may be helpful: http://www.infopathdev.com/forums/p/6824/36664.aspx

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