Should this support CCK drop downs, radio buttons and checkboxes? It won't accept changes for me on these types - neither in a view nor the node page.

Comments

mdowsett’s picture

I'm pretty sure this answer is 'no'.

My problem is that I first used editablefields to create a really useful View with fields you can edit and click on the submit button. The fields were date and radio buttons. I was really happy with this.

But then I wanted a node (Bio in this case) to have ajaxeditable fields (just text fields)...with contemplate and this module, it worked like a charm.

The problem is that by enabling this module (ajaxeditable) is screwed up my View with editablefields due to ajaxeditable not supporting these CCK types.

Can it be fixed?

bighoffa’s picture

I was having the same issue. I did some debugging and it turns out that in my site, some of the fields have the "format" attribute set, and it is not being passed in the request. This was causing the field to not be updated. I am sure that there is a better solution, but I added an "unset" of the "format" attribute retrieved from the node to fix the issue.

See below for updated code -- the unset after the 2 line comment is what I added:

function ajaxeditable_submit()
{
  $nid=$_POST["nid"];
  $node=node_load($nid);
  
  //print_r($node);

  if (node_access("update",$node)) {
    unset ($_POST["nid"]);

    foreach ($_POST as $field=>$value) {
      $field=preg_replace("/editablefield_\d+_(.*)/","$1",$field);
      if (is_array($node->{$field}[0])) {
        if (count($value)==1 && is_array($value[0])) {
          $value=$value[0];
        }

// Added unset to fix the issue of some fields expecting format to be set, but not passed causing field to not
// be updated -- mlh 20080407
unset($node->{$field}[0]["format"]);

        if (count($value)==1 && count($node->{$field}[0])==1) {
          $value=array_combine(array_keys($node->{$field}[0]),$value);
        }
//        drupal_set_header('HTTP/1.1 404 Not Found');
//        print serialize($node->{$field});
        
        
doc2@drupalfr.org’s picture

Status: Active » Needs review