Umbraco forms - form validation summary alternative
I know we can put the form validation summary - is it possible to put a message if there a validation errors something like
"Please ensure all fields are filled in" beside the submit button?
$('input[type*="submit"]').on("click", function () {
var formId = document.activeElement.id;
var errorDiviD = "FieldWarning" + "-" + formId;
var divErrorList = document.getElementById(errorDiviD);
divErrorList.classList.remove("invisible");
})
I put a new div on form.cshtml that contained the text I want to display beside the submit button. It doesnt stop the default behaviour of the form. But will display the warning if the form doesnt go to the thank you thank page.
Umbraco forms - form validation summary alternative
I know we can put the form validation summary - is it possible to put a message if there a validation errors something like "Please ensure all fields are filled in" beside the submit button?
Hi Lori,
what happens when you try the following code:
it just shows the message all the time becasue Html.ViewData.ModelState.IsValid is false when the form isnt filled in
Maybe something like this would work:
You could then use hasErrors to display the message?
I think we maybe onto the wrong track Brendan when I submit the error count isnt actually counting the fields validated.
I changed the code to the following so I could see the errors
and one of the errors was includeScripts 0
but on submission it didn't catch any of the non validated fields.
ended up going with
I put a new div on form.cshtml that contained the text I want to display beside the submit button. It doesnt stop the default behaviour of the form. But will display the warning if the form doesnt go to the thank you thank page.
is working on a reply...