1

I'm altering a comment form and on my page i want to show a modal to ask the user for an answer then i will submit.

I tried to drupal_get_form on a ctools modal but a lot of problem on submit it will return to the same submit page and an outher problem with the form_i can not get.

is there any good example or a good idea to do that?

2
  • Do you need to submit the values entered in the modal form along with the first form?
    – AKS
    Commented Dec 31, 2014 at 9:56
  • @AyeshK Yes i want to do that
    – Adel
    Commented Dec 31, 2014 at 9:59

1 Answer 1

0

Create a file named as 'search_result.js' and include it into the particular module using drupal_add_js(path/filename.js); and the copy and phaste the following code into search_result.js

 (function($, Drupal, window, document, undefined) {

Drupal.behaviors.searchResults = {
  attach: function(context, settings) {

       $("#elementID").click(function(){
        if(confirm("Are you sure that you want to proceed?")){
            return true;
            }
        else {
            return false;
            }
        });
  }


}
})(jQuery, Drupal, this, this.document);  

Note: "#elementID" is the id of the element on which when you click the confirm window is shown

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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