Form Validierung bei Bootstrap Modals?

Dustin84

Erfahrenes Mitglied
Hallo,

klicke ich auf meinen Login Button, so wird das Login-Formular per Ajax in die Modalbox geladen.

Leider greift dann die Formular Validation nicht, da die Form neu in den DOM geladen wurde, richtig?!
Ich benutze diese Validierung: bassistance.de » jQuery plugin: Validation

Dazu habe ich jetzt folgendes probiert:

Code:
// Init remote modals
function get_remote_modals(target) { // target ist die ID vom Login Modal
	$.get('/_remote/modals.php', function(response){
		// Filter response
		response = $(response).filter(target);
		// Init Modal
		$(response).modal()
		.css({
			'margin-left': function (){
				return -($(this).width() / 2);
			}
		})
		.on('submit', function(){
			$(this).validate(); // Warum geht das nicht?
		})
		.on('hidden', function(){
			// Remove existing modals
			$(this).remove();
		});
	},'html');
}

Jemand eine Idee?

Gruß
D.
 

Neue Beiträge

Zurück