Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Giovanni Sidoel 94 posts 233 karma points
    Mar 05, 2019 @ 16:20
    Giovanni Sidoel
    0

    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:

    [NullReferenceException: Object reference not set to an instance of an object.]
    

    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, IDictionary2 parameters) +157 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 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.WrappedAsyncResultBase1.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) +159

  • Giovanni Sidoel 94 posts 233 karma points
    May 29, 2019 @ 12:02
    Giovanni Sidoel
    0

    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.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies