4

I am working on SharePoint 2013 office 365, Infopath 2010.

I have a requirement when user selects "Approved" from the given dropdown list and clicks on save button then the text boxes in infopath form should be disabled. I want to achieve this functionality using programmatically because i have like 20 text boxes in the form.

I tried out conditional formatting on text boxes by reading the value on drop down list i can disable text boxes and save it. But when the user comes back and changes the drop down value the text boxes are editable again.

I want to save the state of textboxes after user selects approved from dropdown list and clicks on submit and it should be completely disabled for editing for next time.

Edit: Problem is that user is going to use the form again and again. I have like 20 text boxes and user enters data in 2 text boxes and then he sends it for review and they select approve from dropdown list and these two text boxes should be disable for editing after approved.

Again user is going to reuse the form by entering the data in another text boxes he sends it for review. The reviewer should differentiate the newly added ones either by disable the old text boxes or color coding.

Thanks

1 Answer 1

1

Saddly, InfoPath doesn't allow for much in the way of coded solutions. Especially online.

I was able to build a Form with 3 fields: DisableMe a text field to be disabled, DisabledFields a text field to store the disabled field's names and a drop down that triggers the disable process.

Since you have many different fields, you can create one text field where you will store the name of each field that has been disabled. The new conditional formatting rule will be if the text field's name is contained in the value of that field.

The setup is:

Create a field called DisabledFields of the type text

Set the action for the Dropdown to set the value of DisabledFields to concatenate the name of each field if it has a value in it - when it is set to approved.

It would be a long concat like below, adding one substring(...) for each field that will be possible to disable

concat(substring("DisableMe", 1, (string-length(DisableMe) > 0) * string-length("DisableMe")), "")

This explains the substring rule I used

You then set as the conditional formatting rule for the text fields

contains(my:disabled, "DisableMe")

You can probably improve the solution so you can use more copy and paste then as I have put it here...

5
  • Problem is that user is going to use the form again and again. I have like 20 text boxes and user enters data in 2 text boxes and then he sends it for review and they select approve from dropdown list and these two text boxes should be disable for editing after approved. Again user is going to reuse the form by entering the data in another text boxes he sends it for review. The reviewer should differentiate the newly added ones either by disable the old text boxes or color coding. Thanks Oct 21, 2014 at 1:05
  • @pradeep InfoPath doesn't have much in the way of programming when it's online. I have edited my post with a possible solution. I was able to get it to work on a quick POC on my machine.
    – Choggo
    Oct 21, 2014 at 1:45
  • Choggo, I was able to solve the problem with what you suggested but I was wondering instead of setting the action for dropdown to set a field value whether I can achieve the acieve the functionality using button click. I tried to assign the value to field when user clicks on button but data doesnt populate into the field. Oct 21, 2014 at 19:20
  • Button click should work as well. Try enabling postback on the button? (I don't remember if it comes enabled by default)
    – Choggo
    Oct 21, 2014 at 19:22
  • Its works... I did minor mistake that was the reason it failed..Thanks Oct 21, 2014 at 20:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.