I have built a site using drupal 7.41. I have added the login form by adding this line in my page.tpl.php "print render($page['login_container']);".

When user click on the login button I want to show a popup with options "yes" and "no". only when the user choose "yes" he/she should be logged in. I need change the style of this pop up, that's why I cannot use jquery window.confirm function.

I went through drupal documentations and found about the function confirm_form. this is what I am trying to do, but not able to.

I created a hook menu and then called the confirm_form fucntion. But I am not able to call this from the login submit button.

  • Drupal doesn't have that functionality, you could easily provide it using javascript though – Clive Nov 25 '15 at 12:06

Sounds like some simple Javascript. E.g. by the help of JQuery you could bind a click/submit function on the login-form, show a confirm-window ("Would you really like to log in?") and if this is confirmed, submit login-data (or not).

Such a function could(!) look similar to this:

 var r = confirm("Would you really like to login?");

 if (r == true) {
    return true; // submit form-data
 } else {
    return false; // stay on page
  • i need to style the pop up. – vipin p Nov 28 '15 at 12:36
  • 1
    Hmm, in such a case you could try out to implement JQuery-UI which offers an easy way of styling dialog's. – Hotte Unzensiert Limitiert Nov 28 '15 at 12:47

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.