0

I've got a Bootstrap modal that I use to present a form through which I can create and edit an node on my site. This object has an uploaded file associated with it, so things work in the usual way: when I create the object, I get the "Browse..." field for selecting the file; when I edit the object, I get a little rendering of the file and a "Remove" button that is meant to let me get rid of the old file and pick a new one.

I haven't been able to get/figure out the Drupal ajax mechanism to work with my modal form, and, without it, clicking the Remove button refreshes the whole page, which blows my modal away and is clearly the wrong thing. So I wrote some jQuery code for the Remove button: when the button is clicked, it removes the file's little rendering and inserts the same sort of file input field as when a node is created. This works; the code I get on the page is the same as what's there when I'm creating a new node.

The problem (finally!) is that, after this file field is inserted into the modal, clicking the "Browse..." button doesn't do anything -- it doesn't bring up the system file selection panel that will let me choose the file. I'm not seeing any error messages show up in the system log or the javascript console; I just get nothing (in several different browsers). Any clues on what's going wrong? Is there some initialization thing I have to do to get the system to pay attention to the newly-arrived input field?

0

False alarm -- a bit more hacking showed that I was putting the field into a part of the page where it didn't want to be. Why this resulted in the "Browse..." button not working is still a mystery, but all is currently well.

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.