Specify controller to post xform?

Kurt Fällström
Member since: 2010
 

I'm having an XForm on a block and I want it to post to a specific controller. I'm tring to use the XFormParameters-class and pass it to the PropertyFor-method, but the controller-part of the form action attribute is not changed as specified by the parameters but the other parameters are included in the action.

I specify XFormParameters like this:

viewModel.FormParameters = new XFormParameters()
                    {
                        PostAction = currentBlock.PostAction,
                        FailedAction = currentBlock.FailedAction,
                        SuccessAction = currentBlock.SuccessAction,
                        PostController = currentBlock.PostController
                    };

and render the xform like this:

@Html.PropertyFor(x => x.CurrentBlock.Form, Model.FormParameters);

Should it be done some other way?

#66039 Feb 18, 2013 19:30
  • Kurt Fällström
    Member since: 2010
     

    It was just a syntactic error, this works much better:

    @Html.PropertyFor(x => x.CurrentBlock.Form, new {XFormParameters = Model.FormParameters} )

    #66057 Feb 19, 2013 8:53