We intend using editablefields on one of our websites, but we want 'clicktoedit' fields to collapse after loosing focus.

We created a patch on editablefields version 6.x-1.2. It still needs some work. In particular, 'single on/off checkboxes' are not supported and 'textareas' are implemented with a small bug.

The 'single on/off checkbox' is not supported because of its strange behavior. We recommend using radio buttons instead.

The 'textarea' suffers from a strange feature probably deep down in JQuery. Clicking on a 'clicktoedit' field does not set the focus to that field. It needs a second click to actually set the focus to a field. So we implemented focussing with one click in our patch. Only the 'textarea' suffers a strange side-effect. After clicking it for the first time we set its focus, but after that the 'textarea' is updated/changed and it looses focus (so you can not edit it) while still expanded. When clicking anywhere in the page (including the expanded 'textarea'), the 'change' event is fired. Any subsequent clicks to expand and collapse the 'textarea' show the desired behaviour.
Any help on this issue would be really appreciated.

Hope there are some people out there that appreciate the work we've done and can help us improve it further.

Comments

batje’s picture

follow

markfoodyburton’s picture

First THANKS for taking the time with this.
If others like this feature, I'm happy to commit the patch...

Cheers

Mark.

Jan van Diepen’s picture

Before you do, there is still a lot of work and testing to be done. Two issues have already been discussed in my original post.

Furthermore, a lot of possible dependencies have to be tested. The ACL and Content Access modules to name but one. Not to mention the File Field and Image Field modules. What will happen if you add an image using them?

Probably the best option is to put it in the development branch. This way, others can also help test and develop it further.

Regards,

Jan

Jan van Diepen’s picture

StatusFileSize
new7.47 KB
new2.64 KB

I did some more testing and coding. I had a look at the "link" and "image field" (and consequently also "file field") modules.

No issues for the "link" module.

Some coding is needed for "image field" ("file field") module to work. Any changes in the file field are not written to the database, but that was already the case with the unpatched 6.x-1.2 editablefields module.
Any help on this issue would also be highly appreciated.

I also had a look at the "multi value" field option. It needed some recoding in the editablefields_view function.

Please find attached a new pair of patch files for the 6.x-1.2 version of the editablefields module (so it is not a patch to my earlier patch).

Regards,

Jan

bfr’s picture

And how do i REMOVE this feature, i want user to see the result?

tharna’s picture

Might be the resizable textarea is causing the problem on focusing on textarea after click. Focus seemed to work fine after I disabled resizable textareas following this instructions: http://drupal.org/node/296908

Jan van Diepen’s picture

Hi bfr,

I posted some patches for the 6.x-1.2 version some time ago. In the meantime I opened a new development branch 6.x-2-x-dev that has the collapsible "click to edit" fields in it. I also added some new features. Try using this development version.

As to your question. I'm not sure what you mean by it. By "collapse" I mean the "click to edit" field will show as ordinary text, with the difference that the label and the text (if there is any text), or the result as you call it, is "clickable". After clicking it it will become editable. After losing focus (by clicking somewhere else on the page) it becomes ordinary text again.

In the development version. You have now 3 options. You can select a field to be "editable (AJAX)", "click to edit", or "editable (HTML)". An "editable (AJAX)" field is always editable and uses an AJAX load. A "click to edit" field becomes "editable" after clicking it or its label and changes back after losing focus. An "editable (HTML)" field is always editable and is an inline HTML widget that improves load times by 90% (see http://drupal.org/node/578678). It is up to you to decide which one to use.

Regards,

Jan van Diepen

Jan van Diepen’s picture

Hi Tharna,

Thank you very much for your input. When I find some time, I will investigate if this can help solve the focusing problem.

Greetings,

Jan van Diepen

bfr’s picture

Ok, then i misunderstood this, because what happens with me is that after it should "collapse", the text disappiers completly(i thought that it was the correct effect, just undesirable for me). Refressing page brings it back.
It happens with the dev version, but not with the older one.

Jan van Diepen’s picture

bfr,

We have not encountered the text disappearing on "collapsing".
Can you provide us with some extra information on the platform you're using (PHP, browser, drupal, etc.)?

bfr’s picture

PHP Version 5.2.6
Latest firefox on ubuntu
I'm not sure where to check the current core version, but at least the core modules are 6.14 currently.
Theme is generated with Artisteer.

Currently i'm not able to check with other configurations because i have downgraded editable fields to earlier version..
now it works, but of course is missing the latest features, like the html editable, which i would also need because of the speed issue with the ajax editable(checkboxes need to be editable and not
click-to-edit because empty checkboxes show no result at all thus cannot be clicked).

If it works for other users, i think it could very well be theme related? Maybe you change the style to some which artisteer css does not have defined when unfocusing or something similar?

edit:

Updated to latest dev and tried, changing theme does not help, but with opera it works better.. it does not "unfocus" like it should(so the field stays in "edit mode") when clicking elsewhere, but atleast the text does not disappier.

I have firebug installed if you need some output.

edit 2:

correction, happens with opera also.. no idea why it behaved differently the first time i tried.

Jan van Diepen’s picture

We suspect your problem might be java related or your server's reply is not as expected.

To further determine the cause of the problem, there's two things we can do:

1) If your website is publicly available? We could have a look at it if you send us the url.
2) If it is not publicly available, you could export your node type and post it.

Halffull’s picture

I'm having the same issue as bfr.

Example test site is here: http://lifeofmatt.net/newsitetest/?q=tasktest

batje’s picture

@Halffull I created an account on your site, but i dont see any content types with CCK fields. Can you send me a direct link to a page where you expect editablefields to work?
You can use my contactform: http://drupal.org/user/2696/contact

bfr’s picture

I'm sorry, the site is intranet only, so i cannot give any accounts.. i'm not sure what you mean by exporting node type, and not sure if it helps since it happens with all the content types and fields..
but here's print_r of $node object of one content type, if that is what you ment(don't mind the existence of two different date fields, it's just for testing)

stdClass Object ( [nid] => 962 [type] => worktime [language] => [uid] => 1 [status] => 1 [created] => 1259685075 [changed] => 1259685075 [comment] => 2 [promote] => 0 [moderate] => 0 [sticky] => 0 [tnid] => 0 [translate] => 0 [vid] => 962 [revision_uid] => 1 [title] => admin [body] => [teaser] => [log] => [revision_timestamp] => 1259685075 [format] => 0 [name] => admin [picture] => sites/default/files/user_pictures/picture-1.png [data] => a:10:{s:18:"admin_compact_mode";b:1;s:13:"form_build_id";s:37:"form-e42f4554ca272a3c1a3c449767071cc9";s:14:"picture_delete";i:0;s:14:"picture_upload";s:0:"";s:7:"contact";i:0;s:19:"biblio_show_profile";i:1;s:19:"biblio_my_pubs_menu";i:0;s:21:"biblio_contributor_id";s:1:"0";s:5:"block";a:1:{s:11:"quicktables";a:1:{i:1;i:1;}}s:14:"tinymce_status";s:5:"false";} [field_create_project] => Array ( [0] => Array ( [nid] => 452 ) ) [field_tyoajanseuranta_datetime] => Array ( [0] => Array ( [value] => 2009-12-01 00:00:00 [timezone] => Europe/Helsinki [timezone_db] => Europe/Helsinki [date_type] => datetime ) ) [field_tyoaika_datestamp] => Array ( [0] => Array ( [value] => 1259618400 [timezone] => Europe/Helsinki [timezone_db] => Europe/Helsinki [date_type] => datestamp ) ) [field_worktime_duration] => Array ( [0] => Array ( [value] => 4.0 ) ) [field_worktime_username] => Array ( [0] => Array ( [uid] => 1 ) ) [field_overtime] => Array ( [0] => Array ( [value] => Arkipäivä ) ) [og_groups_both] => Array ( ) [og_groups] => Array ( ) [print_display] => 1 [print_display_comment] => 0 [print_display_urllist] => 1 [print_mail_display] => 1 [print_mail_display_comment] => 0 [print_mail_display_urllist] => 1 [print_pdf_display] => 1 [print_pdf_display_comment] => 0 [print_pdf_display_urllist] => 1 [last_comment_timestamp] => 1259685075 [last_comment_name] => [comment_count] => 0 [taxonomy] => Array ( ) ) 

Edit:

I also tried the site from @13, but the view he links seems to be empty? Cannot see any cck fields anywhere.

batje’s picture

@bfr, there is a module included in cck called "Content Copy". If you enable that, you can export your nodetype definition. We can then import it and have a look at it.

Halffull’s picture

batje, I responded in your contact form, but I figured I might as well respond here as well.

The appropriate view is in the link abe which I posted.

bfr’s picture

There is nothing editable in the link you provided.. I'm guessing you forgot to give permissions to your cck fields to authenticated users.

lelizondo’s picture

subs

Jan van Diepen’s picture

Status: Active » Closed (fixed)

Committed in release 6.x-2.0