I am using this module for the registration and login to my site. The forms are displaying in the ctool modal.

While registering new user and enter the correct information in the form, then the form working fine but the problem occurs after resubmitting the form.

If i enter incorrect information the form displays the validation errors in form then when i try to resubmit the form it displays me a white page which has the url of http://example.com/ajax_register/login/ajax

and displaying the following content on the page and nothing else.

[ {"command":"settings", "settings":{"basePath":"\u002F", "pathPrefix":"", "ajaxPageState":{"theme":"videos", "theme_token":"uYFTHNtlWVrjdFrZEaZz9q7kqdYFsInggO_fpjyGP_s"}, "fbconnect":{"user_pictures":"allow", "language_code":"en_US", "app_id":"194519154027804", "debug":1, "connect_js":"document.location.protocol + \u0027\u002F\u002Fconnect.facebook.net\u002Fen_US\u002Fall.js\u0027", "loginout_mode":"auto", "invite_name":"ADSW", "fast_reg_mode":0, "fast_reg_autoname":0, "fbuid":0, "user":{"uid":0, "fbuid":null}}, "ajax":{"edit-submit":{"callback":"ajax_register_user_login_ajax_callback", "wrapper":"ajax-register-user-login-wrapper", "event":"click", "url":"\u002Fsystem\u002Fajax", "submit":{"_triggering_element_name":"op", "_triggering_element_value":"Log in"}}}}, "merge":true}, {"command":"modal_display", "title":"Login", "output":"\u003Cdiv id=\u0022ajax-register-user-login-wrapper\u0022\u003E\u003Cform action=\u0022\u002Fajax_register\u002Flogin\u002Fajax\u0022 method=\u0022post\u0022 id=\u0022user-login\u0022 accept-charset=\u0022UTF-8\u0022\u003E\u003Cdiv\u003E\u003Cdiv class=\u0022form-item form-type-textfield form-item-name\u0022\u003E\u000A \u003Clabel for=\u0022edit-name\u0022\u003EUsername or e-mail address \u003Cspan class=\u0022form-required\u0022 title=\u0022This field is required.\u0022\u003E*\u003C\u002Fspan\u003E\u003C\u002Flabel\u003E\u000A \u003Cinput type=\u0022text\u0022 id=\u0022edit-name\u0022 name=\u0022name\u0022 value=\u0022\u0022 size=\u002260\u0022 maxlength=\u002260\u0022 class=\u0022form-text required\u0022 \u002F\u003E\u000A\u003Cdiv class=\u0022description\u0022\u003EYou may login with either your assigned username or your e-mail address.\u003C\u002Fdiv\u003E\u000A\u003C\u002Fdiv\u003E\u000A\u003Cdiv class=\u0022form-item form-type-password form-item-pass\u0022\u003E\u000A \u003Clabel for=\u0022edit-pass\u0022\u003EPassword \u003Cspan class=\u0022form-required\u0022 title=\u0022This field is required.\u0022\u003E*\u003C\u002Fspan\u003E\u003C\u002Flabel\u003E\u000A \u003Cinput type=\u0022password\u0022 id=\u0022edit-pass\u0022 name=\u0022pass\u0022 size=\u002260\u0022 maxlength=\u0022128\u0022 class=\u0022form-text required\u0022 \u002F\u003E\u000A\u003Cdiv class=\u0022description\u0022\u003EThe password field is case sensitive.\u003C\u002Fdiv\u003E\u000A\u003C\u002Fdiv\u003E\u000A\u003Cinput type=\u0022hidden\u0022 name=\u0022form_build_id\u0022 value=\u0022form-DltUUVHw3zD2EIVADg26VYS8_HDivAMp8HhqB87kHmQ\u0022 \u002F\u003E\u000A\u003Cinput type=\u0022hidden\u0022 name=\u0022form_id\u0022 value=\u0022user_login\u0022 \u002F\u003E\u000A\u003Cdiv class=\u0022login-forgot\u0022\u003E\u003Ca href=\u0022\u002Fuser\u002Fpassword\u0022\u003ERequest new password\u003C\u002Fa\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\u0022form-actions form-wrapper\u0022 id=\u0022edit-actions\u0022\u003E\u003Cinput class=\u0022ctools-modal-ctools-ajax-register-style form-submit\u0022 type=\u0022submit\u0022 id=\u0022edit-submit\u0022 name=\u0022op\u0022 value=\u0022Log in\u0022 \u002F\u003E\u003C\u002Fdiv\u003E\u003Cdiv class=\u0027fb-connect-text\u0027\u003E\u003Cdiv class=\u0027title\u0027\u003EFACEBOOK CONNECT\u003C\u002Fdiv\u003E\u000A\u003Cp\u003E\u000AThere are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don\u0027t look even slightly believable. If you are going to use a passage of Lorem Ipsum\u000A\u003C\u002Fp\u003E\u000A\u003Ca href=\u0022https:\u002F\u002Fwww.facebook.com\u002Fdialog\u002Foauth?client_id=194519154027804\u0026amp;redirect_uri=http%3A\u002F\u002Fadsw.cactimedia.net\u002Ffboauth\u002Fconnect\u0026amp;scope=email\u0022\u003E\u003Cimg src=\u0027\u002Fsites\u002Fall\u002Fthemes\u002Fvideos\u002Fimages\u002Ffb-button.png\u0027 \u002F\u003E\u003C\u002Fa\u003E\u000A\u003C\u002Fdiv\u003E\u003C\u002Fdiv\u003E\u003C\u002Fform\u003E\u003C\u002Fdiv\u003E\u003Cscript type=\u0022text\u002Fjavascript\u0022\u003E\u000D\u000A\u0009function labelShowHide() {\u000D\u000A\u0009\u0009var field_value = jQuery(this).val();\u000D\u000A\u0009\u0009var label_element = jQuery(\u0027label[for=\u0022\u0027+jQuery(this).attr(\u0027id\u0027)+\u0027\u0022]\u0027);\u000D\u000A\u000D\u000A\u0009\u0009if(field_value == \u0022\u0022) {\u000D\u000A\u0009\u0009\u0009jQuery(label_element).show();\u000D\u000A\u0009\u0009} else {\u000D\u000A\u0009\u0009\u0009jQuery(label_element).hide();\u000D\u000A\u0009\u0009}\u000D\u000A\u0009}\u000D\u000A\u0009jQuery(document).ready(function(){\u000D\u000A\u0009\u0009jQuery(\u0022form input[type=text], form input[type=password]\u0022).bind(\u0022keyup change\u0022, labelShowHide);\u0009\u0009\u000D\u000A\u0009\u0009jQuery(\u0022form input[type=text], form input[type=password]\u0022).each(labelShowHide);\u000D\u000A\u0009});\u003C\u002Fscript\u003E"} ]

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Spleshka’s picture

Status: Active » Closed (works as designed)

Try to search an error in your JS. Module works properly even after re-submit when form validation fails.

tim.plunkett’s picture

I can confirm that this is still broken.

tim.plunkett’s picture

Status: Closed (works as designed) » Active
Spleshka’s picture

@tim.plunkett,

Can you provide steps to reproduce this error? Can you reproduce it on the demo site?

tim.plunkett’s picture

Status: Active » Needs review
FileSize
658 bytes

The "Enable links in modal window" setting is what was breaking that. It's on by default, I'm assuming its on for your test site, and nothing is broken when it is on.
However, when it is off, the form is incorrectly processed, and AJAX commands are printed to the screen.

Here's the fix.

tim.plunkett’s picture

Steps to reproduce:

  • Turn off "Enable links in modal window"
  • Allow visitors to register an account
  • Set the register behavior to "refresh" or "custom redirect"
  • Attempt to register with an error (duplicate username/email)
  • Resubmit the form with valid information

Expected result:
Refresh, or custom redirect

Actual result:
AJAX commands printed to screen, as in the OP

tim.plunkett’s picture

Title: ajax error on resubmitting the registrationf form after validation error. » After validation errors, resubmitting the registration form prints AJAX commands to screen
Spleshka’s picture

Not sure that your patch is totally correct. I digged deeper and found bug. What do you think about my patch?

Spleshka’s picture

The next 30 minutes you can try it in sandbox http://s8768826cbd09e81.s2.simplytest.me/

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

That works just as well, the problem was primarily that if ajax_register_form_enable_modal_links was FALSE, _ajax_register_add_ajax() would be called, and this avoids that in a similar way. Thanks!

Also just opened #1928252: User login block is not rebuilt correctly on error, one more bug to come after that and then I think I'm done :)

Spleshka’s picture

Thanks, commited to 7.x-4.x!

I'm really appreciate your help. If you are looking for other modules that deserves your attention I'd suggest you to pay attention at the Path Breadcrumbs module :)

Spleshka’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

saurabh.3009’s picture

Version: 7.x-4.0-rc13 » 7.x-4.0-rc15
Issue summary: View changes
Issue tags: +Create account popup not opening