TopicDetails.cshtml validation bug fix
If the user creates a page that is password protected, and that page contains a form with validations, the validations do not work. We need to re-run the validation plugin after the content is loaded after successful authentication.
So we need to change this...
if (data.Authenticated) {
$('#ph-topic #ph-title h1').html(data.Title);
if ($('#ph-topic #ph-title h1').text().length == 0) {
$('#ph-title').hide();
}
$('#ph-topic .page-body').html(data.Body);
$('#ph-password').hide();
$('#ph-topic').show();
}
to this...
if (data.Authenticated) {
$('#ph-topic #ph-title h1').html(data.Title);
if ($('#ph-topic #ph-title h1').text().length == 0) {
$('#ph-title').hide();
}
$('#ph-topic .page-body').html(data.Body);
$('#ph-password').hide();
$('#ph-topic').show();
//re-run the validation plugin in case the loaded html contained a form.
$.validator.unobtrusive.parse("form");
}
Awesome work guys, keep it up!
Thanks,
Brad