Steps to reproduce:
* add a CCK field to a content type, create a node in fill some data into the field
* activate events on the node form and create a rule with the event "content type form is being built"
* add an action "disable from element" with the element ID of your CCK field
* now edit the node you created (the cck field should be greyed out) and hit save ==> the content of the field is gone

CommentFileSizeAuthor
#4 rules-733558.patch3.68 KBklausi

Comments

nodecode’s picture

I'm coming from this thread: http://drupal.org/node/557906#comment-2679228http://drupal.org/node/5579...

and i have the same problem.

henrijs.seso’s picture

Status: Active » Closed (works as designed)

I think naming of this action is little off, but it works as supposed. It probably should be renamed from 'disable from element' to 'unset (or don't show and save) from element'. There is another action to hide element without unsetting, use that.

nodecode’s picture

Status: Closed (works as designed) » Active

I am already hiding the element at this point because disabling the element has been BROKEN in the current 6.x-1.x-dev version. The 6.x-1.1 Rules release properly disabled the field WITHOUT deleting the information in it. I've worked in many programming languages and disabling an element SHOULD NOT also erase the data inside it. So no, it's not working as it should.

See for yourself, install the 6.x-1.1 version and follow the steps in the first post here. The whole point of "disabling" a field rather than "hiding" it is that you can still see the data in the field but you cannot change it.

klausi’s picture

Status: Active » Needs review
StatusFileSize
new3.68 KB

As far as I can see this is a severe form API bug. The browser does not submit a value and the existing default value should be kept, which is not the case.

I talked to fago and we decided to remove the support for disabling form elements from Rules Forms until this bug is fixed or we can come up with a non-hackish workaround. Otherwise we easily break people's data, which we do not want to in the upcoming Rules 1.2 release.

Here is a patch that removes Disabling fields and will be committed soon.

YK85’s picture

subscribin - it would be very nice to have an action to "disable and unset form element" as well as "disable form element" Thank you

klausi’s picture

Status: Needs review » Fixed

Patch committed.

@yaz085: "disable and unset form element" does not seem to be a useful action to me (you can use (un-)set value of a cck field instead). "disable form element" does not work as expected, so we remove it for now. Patches against the form API or other ideas are welcome.

klausi’s picture

Title: Action "Disable form element" erases field values » Remove Action "Disable form element" because it erases field values
nodecode’s picture

@klausi > do you know at what point this was broken? I ask because I was using "disable field" in 6.x-1.1 and it worked fine most of the time unless it ran into the issue from this thread: http://drupal.org/node/557906#comment-2679228http://drupal.org/node/557906

I'm just curious as to where one might begin to look for a possible solution.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.