The field "Merk" is dropdown field with prevalues from xpath.
When you select an option in "Merk" an additional field will show "Model". This field also has prevalues from xpath.
I have several of these Model fields setup with conditionals to show for each Merk option. Each one has their own prevalue source and ofcourse their own alias (eg: modelIsuzu, modelVolkswagen, modelHonda, modelSubaru)
Merk is marked as mandatory, the Model fields are not.
Furthermore this form is meant to have these 2 fields prepopulated from the values in the querystring, so the default values are setup in these fields as [@model] and [@merk].
Turns out it had nothing to do with xpath or the dropdown fields. Instead Forms seems to lose it when you use "model" ([@model]) as default value. I changed it to "vmodel" and then it worked fine.
Error when pre-selecting xpath dropdown fields
I've come across a curious case whereby I have the following form setup: https://fernandesautomotive.com/voertuigen/offerte-aanvragen/
The field "Merk" is dropdown field with prevalues from xpath. When you select an option in "Merk" an additional field will show "Model". This field also has prevalues from xpath.
I have several of these Model fields setup with conditionals to show for each Merk option. Each one has their own prevalue source and ofcourse their own alias (eg: modelIsuzu, modelVolkswagen, modelHonda, modelSubaru)
Merk is marked as mandatory, the Model fields are not. Furthermore this form is meant to have these 2 fields prepopulated from the values in the querystring, so the default values are setup in these fields as [@model] and [@merk].
So when I try to submit a form like https://fernandesautomotive.com/voertuigen/offerte-aanvragen/?merk=Volkswagen&model=Amarok I receive a null reference error in the formhandler
But when I leave out the querystring parameters and have the fields initially empty, It submits as expected.
Below is the error:
Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel model, Boolean captchaIsValid) +17 lambdamethod(Closure , ControllerBase , Object[] ) +143 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary
2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +27 System.Web.Mvc.Async.AsyncControllerActionInvoker._5(IAsyncResult asyncResult, ProcessRequestState innerState) +21 System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9874049 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +159Turns out it had nothing to do with xpath or the dropdown fields. Instead Forms seems to lose it when you use "model" ([@model]) as default value. I changed it to "vmodel" and then it worked fine.
is working on a reply...