Some times, you want to hide a field in frontend or backend item edit form or in both.
-- Of course when the field is hidden in the form it will maintain it's existing value.
Method 1:
(For end-user / web-designers:)
There is a field property in field configuration, that allows to select to hide the field in frontend / backend or both item forms.
Also in the case text field (and a few other fields), there is also a new parameter to FORCE a default value when displaying the field a without ever needing to save any field value in the database.
-- The above can be useful if you want to add a field to all your (thousands) items without need to re-edit them.
-- This also becomes really useful for triggering specific plugins inside the text field, without need to display the field in the item form
Method 2:
(For Developers:)
To define a field as being ALWAYS hidden in the edit form for e.g. field myfield:
Edit the file myfield.xml
To hide in backend, add a hidden parameter called backend_hidden:
1
|
<field name="backend_hidden" default="1" type="hidden" label="Hide in backend form" description="" />
|
To hide in frontend, add a hidden parameter called frontend_hidden:
1
|
<field name="frontend_hidden" default="1" type="hidden" value="1" label="Hide in frontent form" description="" />
|
NOTE: to hide in both frontend and backend, add both parameter.
NOTE: for J1.5 use param instead of field