How to hide a field in the item edit form

  • Published by
    George Papadakis
  • Last modified
    08 November 2013
  • Up to date
    Yes
  • Profile concerned
    End user, Webdesigner, Developer
  • Concerns
    Plugins
  • Since Version
    1.5.6
  • Voting
    Average rating
    5 votes
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    235 How to hide a field in the item edit form /documentation/tutorials-english/79-forms-and-submission/235-how-to-hide-a-field-in-the-item-edit-form.html
  • Tags
    developer, plugins

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