1

I've got a fairly straightforward "user profile" content type. The design of the edit page for this content type has the Imagefield file uploader/thumbnail preview in the right sidebar rather than in the main content area.

I've tried several different methods to get this to work out, and none of them have yet worked. The one I'd like to use is to grab the form-field wrapper with jQuery, and then append it to the right-sidebar region. Like this -

$('#profile-pic-ahah-wrapper').appendTo('.region-sidebar-right .section');

For some reason, this renders the submit button on that form field totally unresponsive. It's still there, it still shows up when I tinker with it in Firebug, but it doesn't respond to clicks or hovers at all. I'm stumped for now, except that I guess this has something to do with it being AHAH?

Thanks in advance.

0

I think you need a clone() in there to move the event handlers along with it. Check out http://api.jquery.com/clone/ and see if that helps.

1
  • Hey, thank you. I probably should've mentioned that I tried clone(), I tried clone().insertAfter(). I tried dropping 1.4.4 in the replace/ folder and using detach() just to see if that'd work. I'm not even sure if it is because of the AHAH factor, but I'll get back at it today. – JGrubb Dec 30 '11 at 11:48
0

So the problem turned out to be two things. My approach with picking up the imagefield with appendTo() and moving it to the sidebar was failing because I was actually moving the form element outside of the form to which it belonged. So that was never going to work.

The other approach that I had tried was just setting position:absolute on the element and moving it over to the sidebar. This worked fine until I interacted with the element, either removing an existing picture or uploading a picture, and then it disappeared from the screen completely. Someone else dug into it with me and found that the element that I was moving - #edit-field-profile-pic-0-ahah-wrapper - had another element nested inside it with this exact same id. Whenever I interacted with the element, this other element would pick up the css and zoom another 800px to the right and off my screen.

So the lesson here is that there's a bug in the filefield module - http://drupal.org/node/815206

The problem was solved by using JS to add another class to the element I was trying to target in the first place. Problem solved in 5 minutes (and 2 days).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.