I am familiar using ctools and modal forms. But now I have to implement multiple nested modal forms. I have a link "Edit contact", this opens a modal form. At the top of the form I have another link "Delete contact", which opens a second modal form which asks the user if he/she is sure if he/she wants to delete the contact.

The response of the first modal form (as expected) is in JSON format: enter image description here This works nice and easy.

When I click "Delete contact" (second modal form), the response is HTML: enter image description here

Because of this reponse I get following error: enter image description here

Help? :)

  • Interesting question, I think you should add a minimum case to reproduce the problem to the question though. Currently it's really hard to try this and help out. :)
    – Letharion
    Nov 8, 2014 at 17:46
  • WHat do you mean by a minimum case? Even when my 2 modals are empty, I get the same error. So it has nothing to do with the content that I'm rendering in my modal form...
    – Robin
    Nov 8, 2014 at 17:51

2 Answers 2


I think you need to create your own ajax handler for this. The idea would be to check if an existing modal exists and rather than add a new one, simply run a replace in your existing one. If non exists, you'd need to setup a new modal.

The other approach you can take, is rather than just forcing it to opena new one, send an ajax request to close the existing one and then present the new one.

Either way, I do not believe there is an easy or straight solution for this particular problem.


Try updating ctools module to latest development release.

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.