Confirmation pop up on login submit

Drupal Answers Asked by vipin p on February 22, 2021

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.

One Answer

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

Answered by Hotte Unzensiert Limitiert on February 22, 2021

Add your own answers!

Related Questions

Changing library path with hook_library_info_alter

1  Asked on September 8, 2020 by extect


How can execute batch api over cron jobs

3  Asked on September 6, 2020 by johntang


How can I programatically add a shipping method to a store?

1  Asked on September 4, 2020 by vintorg


Local Dev .theme file not loading

1  Asked on September 4, 2020 by jmichael


Webform submitted data in views

5  Asked on August 31, 2020 by user3783391


Export and Import Taxonomies and Extra Fields

1  Asked on August 21, 2020 by monkeyuser


How to resolve lazy_builder error?

1  Asked on August 19, 2020 by usernameabc


redirect whole site to HTTPS

3  Asked on August 11, 2020 by naomisl


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP