I have an EPiServer form loaded on a page and my goal is to get the form to submit via an AJAX call instead of a full page post.
After searching around, I've noticed that there are a few boxes to check to make sure everything is setup to work properly.
I've confirmed the first item is correct and moved on to the second item. When trying to add this line in the layout file, I get the following error:
"HtmlHelper does not contain a definition for RequiredClientResources..."
It looks like maybe I'm missing another setup item for this particular piece. Could someone help point me in the correct direction?
Also, if it helps, the form is working properly with the full page post. The only error I'm seeing in the console is:
"Uncaught TypeError: Cannot read property 'Forms' of undefined"
RequiredClientResources is an extendion method in EPiServer.Framework.Web.Mvc.Html. Are you referencing that namespace at the top of your layout file like this:
Thanks for the help! That did in fact solve my issue. I'm new to EPiServer (and .NET in general) so this might be a novice question, but how would I know this?
At the risk of sounding unhelpful, my answer was an educated guess based on instinct and experience. Generally if you're getting an error along the lines of "myClass doesn't contain a definition for myMethod" then it's one of 4 things:
In your case, we know RequiredClientResources should exist which makes 2 and 4 less likely and, as myClass is HtmlHelper which is pretty fundamental to rendering anything in the view, we can assume that we've got the namespace correct so we can rule out 3, making 1 our most likely cause for that error.
If you use something like resharper it can help to resolve issues like that by suggesting the namespace references which might be missing.
Beyond that, I'd suggest keeping a copy of the Alloy demo site to hand as it acts as a handy reference, even for those of us who've been writing Episerver sites for over a decade.
Hope that helps.
@Jeff, If your question has been answered, please click the Accept this Answer box in the post that provides the correct response.