Issue
-
When you are creating a form, sometimes you want to create a field that is read-only because, for example, it is automatically populated by taking information from an API or a database, and you don't want the user to modify it.
-
From Liferay, it was thought to introduce this option, you can see it in the following Feature Request LPS-193313, but it was discarded because it would produce an inconsistency of behavior between the UI and the API that they do not see safe.
Environment
- Liferay DXP 7.1
- Liferay DXP 7.2
- Liferay DXP 7.3
- Liferay DXP 7.4
- Quarterly Release
Resolution
This workaround allows you to modify this property to create read-only fields:
- Create the form as you wish, including the field or fields that you want to be read-only and publish the form.
- Go to the 3 dots on the top bar and click on the import/export option. Configure the export and the content as you want and click Export.
- Download the .lar file and open it. Go to the file ddm-form.json which is in a similar route to this one: /group/20117/com.liferay.dynamic.data.mapping.model.DDMStructure/34408/
- Open that file and change the “readOnly” value, set it to “true”, from the field that you want and save the file.
- Now import that .lar, and you will have your form with a read only field.
Contenido exclusivo para suscriptores.
Una Suscripción Enterprise de Liferay proporciona acceso a más de 1.500 artículos que incluyen las mejores practicas, diagnóstico de problemas y otras soluciones útiles. Inicia sesión para tener un acceso completo.
Inicia sesión