Hi Michael,
You are correct, the conditional logic should happen when you're clicking an option, not on submission of the form.
I believe you are missing key JavaScript that is bundled with Kentico, you should be including the following in your views (or on the layout directly):
@section styles
{
@* Includes stylesheets necessary for page builder functionality *@
@Html.Kentico().PageBuilderStyles()
}
@section scripts
{
@* Includes scripts necessary for page builder functionality *@
@Html.Kentico().PageBuilderScripts()
}
There is an example of this on the tutorial area here.
However, if you don't want to include all of the pagebuilder script, and you specifically want just the form updating code, you could add an MVC bundle that includes the following JS:
~/Kentico/Scripts/forms/updatableFormHelper.js
You can do this by adding/editing the BundleConfig.cs and adding:
namespace DancingGoat.Web
{
/// <summary>
/// Bundle configuration for application.
/// </summary>
public class BundleConfig
{
/// <summary>
/// Register bundles to given <paramref name="bundles"/> collection.
/// </summary>
public static void RegisterBundles(BundleCollection bundles)
{
RegisterCustomFormBuilderBundle(bundles);
}
private static void RegisterCustomFormBuilderBundle(BundleCollection bundles)
{
var bundle = new ScriptBundle("~/bundles/updatableFormHelper")
.Include("~/Kentico/Scripts/forms/updatableFormHelper.js");
bundles.Add(bundle);
}
}
}
and then in the layout file, you can reference the bundle:
@Scripts.Render("~/bundles/updatableFormHelper")