If I submit an empty form, the error validation message will be displayed as many times as I send the form.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

a.sinitsa created an issue. See original summary.

desch’s picture

Any update on this? I am experiencing the same thing.

Cheers!

mayanksonawat’s picture

Assigned: Unassigned » mayanksonawat
Issue summary: View changes
Status: Active » Needs review

Hi There,

I am new to drupal and this is my first ever activity in community.

I've checked this issue and got a solution.

This issue is related to jquery, in file fancy_login/js/fancy_login.js file where we have to empty all the previous existing error messages and replace with our new message. Each time we click on login button append with existing message. So we have first initialize all variable with null value and then remove the message and container using jquery .remove() method.

Hope this solution finds you well.

The below code snippet will support my comment or simply replace the function moveMessages() with existing function's code

function moveMessages()
	{
		messageContainer=null;
		var messages=null;
		messages = $("#fancy_login_login_box .messages");
		
		if(messages.length)
		{
			$(".messages").remove();
			$(".fancy_login_messages_container").remove();
			if(!messageContainer)
			{
				
				messageContainer = $("<div/>", {id:"fancy_login_messages_container_wrapper"}).prependTo("body");
			}

			messages.each(function()
			{
				$(this).appendTo(
					$("<div/>", {"class":"fancy_login_messages_container"}).appendTo(messageContainer)
				).before(
					$("<div/>", {"class":"fancy_login_message_close_button"}).text("X")
				);
			});

			Drupal.attachBehaviors(messageContainer);
		}
	}
imclean’s picture

Version: 8.x-2.2 » 3.0.x-dev
FileSize
981 bytes

A simplified version of #3, this also removes status messages when the modal is closed.

imclean’s picture

Assigned: mayanksonawat » Unassigned