Hi,

I've created a toggle field and configure it to be clickable (on display mode).

When I'm viewing a node, if the field value is set to ON and I toggle it, the value changes to OFF and it's saved properly. However, if the value is set to OFF and I toggle it, the new field value (ON) it is not saved...

Does somebody have the same problem?

Thanks!

CommentFileSizeAuthor
#4 itoggle.clickable.patch579 bytesbkat
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dromansab created an issue. See original summary.

dromansab’s picture

Nobody can reproduce this issue?

goekhanc’s picture

I have the same problem. I would appreciate some hints how this can be solved.

bkat’s picture

FileSize
579 bytes

I just installed iToggle and immediately hit this. The fix is remarkably simple. In itoggle.pages.inc its changing the field value by setting
entity->{$field}[$lang][$delta] = $value;
which works fine for things fields like promote, status, and sticky but for non-property fields that we add to entities we need

entity->{$field}[$lang][$delta]['value'] = $value;

So I modified it to do

      if (is_array($entity->{$field}[$lang][$delta])) {
        $entity->{$field}[$lang][$delta]['value'] = $value;
      } else {
        $entity->{$field}[$lang][$delta] = $value;
      }

Please review the patch and hopefully commit it or a derivative in.

robertgarrigos’s picture

I had this same problem. Applying the patch fixed it, although I had to specify the file to patch.

abhishek.pareek’s picture

Patch at #4 fixed the problem. Thanks !

abhishek.pareek’s picture

Status: Active » Needs review
W.M.’s picture

Patch at #4 solves the problem. Please commit :-)

  • alexweber committed a034d51 on 7.x-2.x authored by bkat
    Issue #2583037 by bkat: Only works when value changes from TRUE to FALSE
    
alexweber’s picture

Assigned: Unassigned » alexweber
Status: Needs review » Reviewed & tested by the community

Thanks for the contribution! Much-needed new release coming in a few hours...

alexweber’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 2.8

Status: Fixed » Closed (fixed)

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