I've searched around in the issue queue for anything related, but I couldn't find anything. Let me know if I'm wrong.

My use-case requires the client to be able to click-to-edit both the title and body of nodes displayed in a views block. The title field is formatted as a link within views. In this setup, if I click the title to edit it, I briefly see an Ajax error message, and the browser follows the link to another page.

Since the link is part of the view display, it surrounds the click-to-edit formatting. The only way I could find to disable the browser from following the link was to remove its href property via jQuery when hovering over it. I'm certainly open to better ways of doing this, however.

I've attached a patch. It certainly works, I just wonder if there's a more elegant way to handle it.

CommentFileSizeAuthor
editablefields-unlink.patch790 bytesrkeppner

Comments

btopro’s picture

I was able to solve a similar issue for node reference fields and link cck fields by adding the following in a behaviors call:

$('.clicktoedit a').each(function(){
	  $(this).attr('href','#');
  });

This should be acceptable functionality since the purpose of clicktoedit fields is to edit them, never to follow them

lunk rat’s picture

Can you explain where to place this code? I also need this to remove links from clicktoedit node reference fields.

Thanks!

btopro’s picture

in any js file that you hook in. I think I did it in my own module to make it work.

socialnicheguru’s picture

I am getting this too

WorldFallz’s picture

Just stumbled across this, solved by adding the following to a js file in my theme:

Drupal.behaviors.themename = function(context) {
  $('.clicktoedit a').each(function(){
    $(this).replaceWith($(this).text());
  });
};
</a>

Removes the links completely (using href="#" caused the page to jump);

As I can't think of a valid use case for allowing anchor tags in the text of an editable field, I would think the better solution would be to remove them in the theme function. But this will do for now.

mengi’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Per https://drupal.org/node/2148735, 6.x is longer maintained so issue is closed. If you wish to be a maintainer of the 6.x branch please create a new issue.