This patch addresses "Javascript: Prevent 'Save' button from being clicked if 'Update' button is visible", specified by Merlin at http://groups.drupal.org/node/9834 .

It disables (and then appropriately re-enables) the 'Save' button when any Views AJAX forms are displayed.

I seem to be getting a WSOD when I try to edit the g.d.o wiki to claim this item so I'll try again later.

CommentFileSizeAuthor
disable-save.patch395 bytesezra-g

Comments

merlinofchaos’s picture

Status: Needs review » Fixed

First, can you use -up as options to the diff? That makes it a unified diff with context; makes it a little easier to read where the changes are being added.

Second, this is a good start but it's unfortunately a little too naive; it doesn't work if forms happen to be chained: Try adding a field, checking a one or more fields, and clicking add.

However, by placing the re-enable to the spot where we update the live preview, I think we do a pretty good job. It's still naive enough to make me nervous that we might miss some edge case, but we'll go with this and see.

So committed, with that change.

mfb’s picture

Would it be possible for the Save button to both Update (if needed) and Save? This would save a little clicking time and effort.

merlinofchaos’s picture

I'm not sure that's a good idea. If it's not really really obvious that this will happen, you might mistakenly update data you didn't intend to; I think it's better to just disable the Save button until you've been forced to commit/cancel. Yes it's an extra click but clarity is worth it, I think. (I could be talked out of this stance, I suppose, if people are convincing that I'm wrong).

ezra-g’s picture

I think it's reasonable to keep save and update as separate buttons. It's nice to have the option to say, "Oops, I didn't want that. At least I didn't click save yet.."

Also, @Merlin: I'll remember to use -up next time. It slipped my mind with this patch.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

matteogeco’s picture

What about a message sayin':

View isn't saved yet, remember to click on "Save" button

(or so'en' similar), that would appear after clickin' on "Update"?