TransWikia.com

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:

$('#user-login-form').submit(function(){
 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!

Ask a Question

Get help from others!

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