Would be useful to hide and/or disable any pre-filled fields.

Comments

jgullstr’s picture

Status: Active » Postponed

Hi eosrei,

This was also proposed by mariusm here. I don't have any plans on adding support for this in the near future. You could do this manually using your own custom form_alter as described in this post. If there is a higher demand for this, or someone writes a patch, I will consider adding this feature. Marking as "postponed" for now.

//Josef

mas0h’s picture

This will be great feature if you decided to do it, and it will much greater if we can decide which fields will be disabled and which will not.

readermoeba’s picture

I've been searching for a module that compliments the entity reference pre-populate module for ages.
A great module but to make full use of it I do really need to be able to (in my case) disable all the pre-filled fields selected. As a Drupal newbie, implementing mariusm's solution is a bit beyond my capabilities, at the moment!
Any help, ideas or suggestions would be very much appreciated.

mas0h’s picture

You can use Rules forms module to disable node form fields.

mlzr’s picture

Hi,
I will be happy also if it is possible to disable the filled fields.

mlzr’s picture

Maybe Rules forms is not working: https://www.drupal.org/node/1780272

mlzr’s picture

Hello, I spend a lot of time to get the filled fields read-only and not working yet. Pleas can you help whit this issue?

The module "field_readonly" don't work fore me because it is depend on module "Field Permissions" witch only alter the fields regardless where they pop up. And I want different behavior from the same field in different bundles.

The module "field_extrawidgets" is exactly what I need bud don't work as expected, or don't work at all.

Then I (mis)use "Field Conditional State" and "Conditional Fields". This modules come close to what I want, bud it is a work- around and don't work good enough. What I see is I can make a field read- only, bud when a value comes in via "Entity reference autofill" then the state of the field is the state of the field witch comes in (=editable :-( ).

My case is:
There are 3 tables. Table A: are fields from table B and C pulled in whit "Entity reference autofill". Table B and C has the same fields (has to be in order to get working with "Entity reference autofill").
Table B is provided and the user may not change the values. Table C can be filled by the user.

With Entity reference autofill I can list table B and C (same fields) and the user can pick a value from it and Entity reference autofill will make a copy of the fields desired to table A. Works fine.

Bud the fields in table A may NOT changed by the user. That is the problem. I can make the field read-only bud then the field in table C are also read only (this is the case with module "field_readonly").

And if I manage to set the field to read- only (with the ugly work- arrond with Field Conditional State or Conditional Fields modules), then when the value comes in (via Entity reference autofill), the field state becomes editable again. Grrrr....

So I'm stuck...

I think this is only going to work within this module. Because this is the only module witch can control the state of the value comes in; and it has set to be (in my case) 'read-only'.

jgullstr’s picture

Hi marchellodepello,

Rules forms works fine for disabling fields, here's an example disabling the Body field on the standard profile's "Page" content type:

{ "rules_disable_body" : {
    "LABEL" : "Disable body",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules_forms" ],
    "ON" : { "rules_forms_page_node_form_form_built" : [] },
    "DO" : [
      { "rules_forms_set_disabled" : {
          "form" : [ "form" ],
          "element" : "textarea:body:und:0:value",
          "disabled" : 1
        }
      }
    ]
  }
}

(You need to enable rules forms for the Page node form)

This will permanently disable the field. I haven't played around much with it, but you should be able disable it conditionally depending on other form values.

//Josef

mlzr’s picture

//Josef
thank you for this super- reply!