Read only Rows for a Repeating Table in Infopath... - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Read only Rows for a Repeating Table in Infopath...

Last post 05-10-2019 09:14 AM by Hilary Stoupa. 16 replies.
Page 1 of 2 (17 items) 1 2 Next >
Sort Posts: Previous Next
  • 07-07-2009 06:25 AM

    Read only Rows for a Repeating Table in Infopath...

     Hi All,

             This is Raj, Recently faced a problem in Repeating Table in the Infopath 2007 Form,

    Controls in the Repeating Table:

    Form contains Repeating Table

    -> First Column contains TextBox 

    -> Second column contains check box's

    -> Third column contains Date Picker.

    Requirement :

    I have multiple users who can open my infopath form. All those user details will be present in the form in the Repeating table. 

    Now when the form is opened by a particular user then his particular row only should be in write mode remaining rows should be in read only mode.

    Is this possible? please reply, Thanking in Advance.

     

    Thanking You,

    With Regards,

    Raj...


     

     

     

     

  • 07-07-2009 01:10 PM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

    Are you using InfoPath 2007? It has a username() function.... if the username was one of the fields in the repeating table, you could use conditional formatting on each field in the repeating table to make it read only if the field in the table that holds the username doesn't match the username() returned by the function....

    Hilary Stoupa

  • 07-07-2009 08:13 PM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

    Yes, as Hilary mentioned, you'll need to use some piece of the user's identity to compare against a value in each row and then use conditional formatting to make those other rows read-only.  It's very easy to do as long as you have a value to match.

  • 07-08-2009 12:02 AM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

     Hi All,

       Thank you for replying me. Yes I am using Infopath 2007. I am getting the present username who have logged in, from the code in the form load event of the infopath form. Now Using this username I have to enable/disable the controls programmatically in the form load event. Please help me,Thanks you All in advance.

     Thanking You,

    With Regards,

    Raj...

     

     

       

     

  • 07-08-2009 12:08 AM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

     Hi All,

    I need that conditional formating to be done through code in form load event..

    Thanking You

    With Regards

    Raj...

  • 07-08-2009 08:35 AM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

    I still don't know what you might have in your repeating table that you could base the conditional formatting ON. That is, if you look at the form when the data is loaded, how do you know what rows a person should be able to change and which not? We have to understand how a person would see or decide that to understand the formatting you could use to make certain rows read only. Conditional formatting is applied whenever the condition evaluates to true, so as long as you know the things you need to base the format on when the form loads, you'll be fine.

    Hilary Stoupa

  • 07-08-2009 12:33 PM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

     Hi Hilary,

         I have a repeating Table with four columns :

    Description :

    First Column: ReadOnly TextBox Control in which I am filling the Active Directory User's. Suppose there are three user's in active directory I have fill this textbox with those users by inserting three rows programatically (this is completed).

    Second Column: Hyperlink in a Optional Section and its address is www.google.com (anything, static value and same in all the rows has of now we will see this later). But the thing is all the rows will contain this control.

    Third Column: Three CheckBox's control, and all the three checkbox's are unchecked and its been created in all the rows (Option to check and uncheck).

    Fourth Column: Date Picker control, this is also created in all the rows (Option to fill the date).

    And there is also an Hidden TextBox in which I am filling with the admin name, this also assigned during run time. This textbox is hidden and present out side the repeating table.

    Operation:

    1) Suppose if there are three active directory user's then it will create three rows each row having the user name filled in textbox along with the other three controls in other there respective columns of that row.

    2) Now the conditon is, if the admin opens the form he should able to edit all the other fields in any row except the textbox's since those are readonly fields.

    3) But when any of those three user's open the form then all the control should get readonly and he should able to click only the Hyperlink which is present in his respective row, where his name is present.

    Hope I am clear with the concept. 

    okay I have done with Point (1) in the Operation's.

    Now how to acheive Point (2) and (3) in the Operation's???

    Please help me, I am very thankfull to you.

     

    Thanking You,

    With Regards ,

    Raj...

     

     

     

     

     

     

  • 07-08-2009 03:04 PM In reply to

    Re: Read only Rows for a Reeating Table in Infopath...

    Hi, Raj!

    That information helps a lot.

    You can do this with conditional formatting, I think. You need to know who is opening the form -- I'm guessing you are handling that since you are setting the admin field at run time. I think what I would probably do is add another field, it can be in a secondary data source, and populate that with the name of the current user when the form loads. Then, on each control in the repeating section, you can set conditional formatting that is along the logic of 'If the current user's username (from the field populated on load) is not equal to the user listed in the field bound to the first text box in the repeating table, make this control read only'. Now, you'll probably need multiple conditions -- if the user is the admin, for example, you only want those first fields to be read only, so you'd need to add another condition for that.

    As far as making hyperlinks read only -- your best bet would be to hide the hyperlinks that don't belong to the user. You can do that by putting the hyperlink control inside of a section and putting conditional formatting on the section. After all, there is no point in showing a hyperlink to a user that you don't want them to click.

    Hilary Stoupa

  • 07-09-2009 12:15 AM In reply to

    Re: Read only Rows for a Repeating Table in Infopath...

     Hi Hilary,

       Thank you Hilary, this helped me to get to my solution. And I could able to achieve the solution. The work around is all about making it possible through the UI from the infopath, Right! (Like, Going to the properties of the control and clicking Display tab and and then selecting Conditional Formatting button and clicking add and setting the condition. Right!). I have achieved to my soultion by doing soo. 

    Now I have to achieve to the above solution through code ( pro grammatically, using VSTA in the Form Load event)  Is this possible? Thank you in advance, please help me.

    I have also seen your Blog its very impressive, I like to Thank you for sharing Knowledge...

     

    Thanking You,

    With regards,

    Raj...

         

     

  • 07-09-2009 09:13 AM In reply to

    Re: Read only Rows for a Repeating Table in Infopath...

    Why do you have to do it in code? I don't understand that requirement at all. I don't believe InfoPath gives us any programatic access to the controls on the form itself, only the fields bound to the form, so a coded solution may not be possible in this case.

    Hilary Stoupa

  • 07-09-2009 09:43 AM In reply to

    Re: Read only Rows for a Repeating Table in Infopath...

     Hi Hilary,

     Thank you soo much Hilary, I was just looking for the solution if it is possible through code or not. I think the same, has you said it is not possible through the code. Okay I will follow the method which you have suggested me early. Had a great discussion, I'm very much thankful to you. Good day...

     

    Thanking You,

    With Regards,

    Raj...

  • 07-23-2009 03:10 PM In reply to

    • WPiersol
    • Not Ranked
    • Joined on 06-24-2009
    • Mt. Olive, AL
    • Posts 5

    Re: Read only Rows for a Repeating Table in Infopath...

    Here are two ways I have handled this...

    In my repeating table I have the following columns:

    1. User - Records the user who entered the comment with the userName()
    2. Comment - Column for the user to leave a comment.

     Method #1 - If you only want the user to be able to edit their comments...

    1. On the Comment field set a condition on "If current user is NOT equal to User field".
    2. If the result is true, make the Comment column "Read-Only"

    Method #2 - If you don't want ANY comment to be editable.

    1. On the Comment field set a condition on "If comment field is NOT BLANK "
    2. If the result is true, make the Comment column "Read-Only"

    Method #2 has a small drawback.  The field is lock to read only as soon as the user presses "TAB" or clicks out of the textbox.  So if they do it by mistake, they have to add another row.

    But for my situation it works great.

    Hope that helps.

    William Piersol

     

     

  • 08-13-2009 07:35 AM In reply to

    Re: Read only Rows for a Repeating Table in Infopath...

    For the draw back. you can have one more column in the repeating table that indicates whether the comment field is editable or not, when the user saves or submits the form, change the value of the field to no. and make the comment field readonly on that condition. that should solve your drawback.

     

    Qazi Anis
    System Analyst
    Bitwise Solutions
  • 05-09-2019 12:37 PM In reply to

    • jvazquez
    • Not Ranked
      Female
    • Joined on 05-07-2019
    • Massachusetts
    • Posts 4

    Re: Read only Rows for a Repeating Table in Infopath...

     Thank you for this information, it works like a charm.  I have a follow up question.  As rows are added to the repeating table and set to read-only, is there a way to flag one row to make it editable?  I tried changing the editable flag from no to yes but it makes all of the rows editable.   Thanks in advance.

    Filed under:
  • 05-09-2019 01:55 PM In reply to

    Re: Read only Rows for a Repeating Table in Infopath...

    This will depend on where the control is that sets the editable flag from no to yes - is it in the repeating table? Is the editable flag also in the repeating table? See attached simple sample - save locally, right click and select design and then preview. It's pretty basic, but should give the general idea :)
    Hilary Stoupa

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