November Happy Hour will be moved to Thursday December 5th.

Specify controller to post xform?

Vote:
 

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:29
Vote:
 

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
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.