ConfiForms: Is it possible to disable edit for a field in the edit dialogue?
Asked by Jonathan Vorndamme:

The disable inline edit function in ConfiForms is very useful, but inline edits have severe limitations (no message on success, no error messages for direct inline edits from views, no (working) version tracking/preventing concurrent edits). Thus, it would be very useful to have a similar option in regular editing or just make the field disable edit (of all forms). This is useful in a scenario, where a form is submitted by one person and the request is approved by others. In this scenario, if I allow the requester to adpt his request, I need version tracking to make sure the approver approves, what he thinks he approves. Thus, due to the version field not working for inline edits, I can only use the regular edit dialogue. And to be sure the data is consistent, I need to show the whole request in the edit window, but I don't want the approver to be able to change the request, so I would need to prevent him from being able to change certain fields. It's also not possible to use the edit restrictions because in that case, the field cannot be filled when the request is filed. Is there a way to achieve this? IMHO, the best would be to change the"disable inline edit" option to "disable edit".


Answers:
author: Jonathan Vorndamme
body: Ok, so there actually is a solution to this: you can configure a rule for field definition to set the field readonly (field name: .\*, condition: !_page.pageProperties(EditPossible):true, action: set field readonly, actionable field name: \<field to set read only\>) and editable again (field name: .\*, condition: _page.pageProperties(EditPossible):true, action: set field readonly, actionable field name: \<field to set read only\>, with reverse rule...:true). Important notes:

- field definition rules in general are not meant to work for inline edits

- the "with reverse rule" field works different for "set field read noly" than for other fields: instead of creating an additional rule of opposite action and condition, it changes the action of the rule to "unset read only state of the field", so you always have to consider two rules.

- in the future, it should be also possible to use \[entry._page...\] in the edit restrictions of fields directly, but as of version 3.5.10 that's buggy.

Thanks [@Alex Medved _ConfiForms_](/t5/user/viewprofilepage/user-id/781630) to help me figure that out.


author: Brant Schroeder
body: [@Jonathan Vorndamme](/t5/user/viewprofilepage/user-id/5225896)

I believe you can make the field read-only... you can set edit/view permissions on the field, so certain user groups can only modify or view the field. I am not an expert but you can submit a support request to the vendor and they are quick to respond <https://wiki.vertuna.com/display/VERTUNA/Support+Request+Form>

comments: author: Jonathan Vorndamme
body: Thanks for your answer. The edit/view permissions unfortunately cannot be set context dependend (in the sense of using the context of the view that is used to edit it) and a static setting would mean that approvers cannot file requests themselves and vice versa, so this is not a solution to my problem unforunately.


author: Alex Medved _ConfiForms_
body: Actually you can, these parameters do accept \[entry.field_name\] notations, so the record itself can be used to manage permissions


author: Jonathan Vorndamme
body: Yes, I can use the record, but I need the information about what page/view is doing the edit in order to achieve what I want (on one page, everything is editable on another page only thesecond half of the form). I guess I could use entry._page to achieve that but the documentation says it's nt always present. What would be the cases where it is not present?


author: Alex Medved _ConfiForms_
body: How the \[entry._page\] is relevant here? I dont understand

What I am saying is that you can have a field (hidden for example) on your form that has a value (that you can change from time to time as per your business requirements) that manages access to edit permissions on another field(s)

Alex


author: Jonathan Vorndamme
body: Unfortunately, I cannot decide based on the entry, what to edit but based on the page where it is edited from - so I need to set the edit permissions different for different pages. My idea was to use page properties and set the editors in the field definition to something like \[entry._page.pageProperties(Editors)\]. This works fine with inline edits for list views and plain views, but not for inline edits in card views or the modal dialogue. I'll create an example and file a support ticket.


author: Alex
body: Hi

you can set up Edit Controls macro with a custom layout, including only the fields (ConfiForms Field macros) you want/need

Alex

comments: author: Jonathan Vorndamme
body: Thanks for that hint, I was always wondering why the edit controls showed the whole form instead of what I configured in the view - of course it makes sense that I can choose the fields in the macro body. But the point is, I want that the person can be sureabout what he/she edits, so if it's not shown, the person cannot be sure the data hasn't been modified in between because the current state is loaded when the edit button is clicked, right? Maybe using page properties to set edit rights could work, if I was able to get a reference to the page, where the view is on. Is that possible?


author: Alex Medved _ConfiForms_
body: Not sure I get your question about the page properties, but your requirement is somewhat conflicts with your last comment - so do you want to show data from the form or not? In any way this could be managed by customizing the macro body contents of the ConfiForms Edit Controls macro


author: Jonathan Vorndamme
body: I want to show data in the modal edit dialogue, but I want to make parts of it read-only for the current view (on other views/edit controls it should be writeable). Basically what the "disable inline edit" field does for inline edits, just for the modal dialogue. As far as I can see, I cannot make data that I show read-only in edit controls without using the field restrictions, while I can achieve the same for inline edits. Is that correct?


author: Alex Medved _ConfiForms_
body: You can use field (definition) edit restrictions or develop rules to set fields read-only with ConfiForms Field Definition Rules macros


author: Jonathan Vorndamme
body: I tried the field definition rules, but setting fields read-only didn't seem to have any effect. I'll create an example and file a suppor ticket to find out if I'm doing it wrong or if it is a bug.


Tags: confiforms