Closed niekvanderreest closed 6 hours ago
Could you share your template please so I can investigate this with as similar as possible to your setup? Thanks.
Could you share your template please so I can investigate this with as similar as possible to your setup? Thanks.
Sure can! It contains commented the Jquery variant that I also tested against my vanilla install and which is working as expected.
@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<ContentModels.Home>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels;
@using Umbraco.Forms.Web;
@{
Layout = null;
}
<!DOCTYPE html>
<html dir="ltr">
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.0.0.min.js"></script>
@Html.RenderUmbracoFormDependencies(Url)
</head>
@*<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.0.0.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.16.0/jquery.validate.min.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/mvc/5.2.3/jquery.validate.unobtrusive.min.js"></script>
</head>*@
<body>
<div class="accessibility-wrapper">
<a class="accessibility" href="#maincontent">Skip to Content</a>
</div>
<main id="maincontent">
@Model.Value("content")
</main>
</body>
</html>
Thanks - I think you are missing the steps described on this page: https://docs.umbraco.com/umbraco-forms/13.latest/developer/rendering-scripts
If you choose to "exclude scripts" from the rendering of the form via the macro, you still need to include them somewhere on the page. Hence you need one of the snippets shown on the docs page I've linked.
@AndyButland It seems you are correct, when i set the exclude stcripts to false, the client vamidation works as expected. I guess this was a misunderstanding of all requirements on my part.
Unreleated question, how can you assure the forms scripts are always loaded where you place the snippet if an editor can still choose to keep the "Exclude Scripts" checkbox disabled?
There's not an easy technical way to do that that I can see, so would say it's more in editor training. For most sites I'd expect it would be best to include this snippet in the place you want the scripts to be rendered, and ask editors to always exclude them if they are adding via a macro.
A brief description of the issue goes here.
Setting up Umbraco Forms with Client-validation by following the documentation will always results in a post on submit, client validation will not stop a submit attempt.
Reproduction
Specifics
Steps to reproduce
Expected result
Following the guide at https://docs.umbraco.com/umbraco-forms/13.latest/developer/prepping-frontend, I'd expect the apnet-clientside-validation script to validate the form and stop submission.
Actual result
No indication of clientside validation actually occuring, the page posts back and reloads after serverside validation, validationmessages are shown on the page, and if the form is placed one a page with vertical scroll the page will "hard" refresh and load at the top (losing scroll position)