I want to hide the field "form key" in all of the webform components. I tried doing it with "*hook_form_alter*" and with "[#access] = false" but I can't succeed in this. I also tried to use "*hook_webform_component_load*".

But in all of those, i can't understand exactly what I need to do to hide the form key field in all of the components in all of the webforms. I can't even hide one component's "form key" field. I don't understand which is the field that i need to modify.

p.s - im using form_builder too.

I'm doing something wrong.

any help will be appreciated. thanks, alexandra.

  • 1
    Can't you just use hidden component of webform.? Jul 21, 2015 at 7:56
  • No, I wanna hide it from the admin interface. not from the view. I don't want users that have access to the admin panel to be able to edit it or see it.
    – Alexandra
    Jul 21, 2015 at 8:04

2 Answers 2


The webform_civicrm module does this (actually it disables it rather than hiding it)

You can see the relevant code here (note this function runs in the context of hook_form_alter).

You could hide it by doing something similar but setting $form['form_key']['#type'] = 'hidden';


Although I have no experience with the Webform Locked Fields module myself, it sounds like the module does exactly what you are asking for (so no custom code needed).

With this module you can lock fields in a webform so that those fields cannot be deleted or modified except by administrators with appropriate permissions.

Users who have the "administer webform locked fields" permission will see a checkbox titled "Webform creator can modify" when they edit a webform component. If that box is unchecked, the component can only be modified or deleted by users who have the the "administer webform locked fields" permission. Other users who have webform creation permission will be taken to a page that says "Not allowed" if they attempt to edit or delete that component.

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.