For each node we are allowing users to edit a textfield and a single on/off checkbox field using a view. For some reason the checkbox requires you to click save, but the textfield updates automatically when you click out of the field. Is there any way to use either only save buttons or only automatic saving? We think it will confuse our users to have each type of field save differently.

Thanks a ton and nice work on the plugin. It's pretty awesome.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jg314’s picture

Category: support » bug
Status: Active » Needs work
FileSize
985 bytes

I realized that this was due to the code in editablefields.js. I have included a patch that will also make checkboxes work without the save button.

All I did was add input[type='checkbox'] to two jQuery selectors.

krlucas’s picture

Status: Needs work » Closed (duplicate)

Marking as duplicate of #1249730: Hide submit button for radio buttons too. Both patches look nearly identical. Auto submitting radio buttons make a little more sense to me than checkboxes given potential latency issues when I want to check more than one checkbox. Thanks!

mikeytown2’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Status: Closed (duplicate) » Needs review
FileSize
897 bytes

Patch in #1 fixed an issue we were having. Re-rolled for latest dev.

bschilt’s picture

Status: Needs review » Reviewed & tested by the community

I have applied the patch in #3 to 7.x-1.0-alpha2+7-dev and it works great!

dags’s picture

Status: Reviewed & tested by the community » Fixed

Committed the patch in #3 to 7.x-1.x. This fixes the issue for views but the regular node display is still off. I imagine we'll want to fix that too.

Status: Fixed » Closed (fixed)

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

_vid’s picture

For anyone still using 7.x-1.0-alpha2 here's the patch in #3 rerolled for alpha2.

jason.fisher’s picture

Patch does not work for checkboxes > 1.

 if ($this.find('input[type=text],input[type=checkbox],textarea,select').length == 1 || $this.find('input[type=radio] ').length > 1) {

Should become:

 if ($this.find('input[type=text],input[type=checkbox],textarea,select').length == 1 || $this.find('input[type=radio],input[type=checkbox]').length > 1) {
_vid’s picture

@jason.fisher; I totally agree. Though we went about it in a different way;

I updated that line to allow 1 or more text, checkbox, textarea and selects and more than 1 radio:
if ($this.find('input[type=text],input[type=checkbox],textarea,select').length >= 1 || $this.find('input[type=radio] ').length > 1) {

In doing so, we noticed that the 'add more' button would disappear. So we also updated that hide() statement:
$this.find('input.form-submit:not(".field-add-more-submit")').hide();

Here's the diff between my patched version in #7 and this:

-      // There is only one editable field in that form, we can hide the submit
-      // button.
-      if ($this.find('input[type=text],input[type=checkbox],textarea,select').length == 1 || $this.find('input[type=radio] ').length > 1) {
-        $this.find('input.form-submit').hide();
+      // Process all editable fields in the forms, hide the submit buttons.
+      if ($this.find('input[type=text],input[type=checkbox],textarea,select').length >= 1 || $this.find('input[type=radio] ').length > 1) {
+        $this.find('input.form-submit:not(".field-add-more-submit")').hide();

It may go beyond the scope of this (resolved) issue so I didn't post a fresh patch but let me know what you think of this solution. If it takes care of your multiple checkbox needs then I'll upload a fresh patch for alpha2.

_vid’s picture

We're still using the patch #7 and I just re-rolled it from within the editablefields directory.
Essentially the only changes are the path:
a/editablefields/editablefields.module b/editablefields/editablefields.module
Becomes
a/editablefields.module b/editablefields.module

HelloStephanie’s picture

The last patch is working for me except not in the Bootstrap theme https://drupal.org/project/bootstrap 7.x-3.0.

Any ideas why it doesn't work with Bootstrap?

HelloStephanie’s picture

Figured it out. This patch should also include alternate forms of input buttons such as Bootstrap's: "button.form-submit"

vadim_k’s picture

does anyone have any idea how to patch editablefields for autosaving selectboxes created by chosen?

jgullstr’s picture

cockers’s picture

#10 worked for me, will this be committed?