MVC XForm

Tobias Lund
Member since: 2013
 

I try to add a XForm property by using 

@Html.XForm(Model.FormArea, new XFormParameters() { SuccessAction = "Success", FailedAction = "Failed" })

The form render fine, but the action method of the form gets like:

<form action="/Contact/Contact-form/XFormPost/?XFormId=72d701fe-c2e9-4bd2-b989-9f50ace5e342&amp;postAction=XFormPost&amp;postController=&amp;failedAction=Index&amp;successAction=Index"
class="form xform"
method="post">

No matter what parameters I'm including in the @Html.XForm helper, I always get the action string like the one above.

When clicking the submit button my ActionResult method named XFormPost get hit, but what to do next? Since my Success and Failure ActionResult methods never get hit how can I know when the form is validated or when it's ready to save?

Any help would be appreciated!

 

#65672 Feb 05, 2013 13:29
  • Marija Jemuovic
    Member since: 2010
     

    Hi, I have posted earlier the code that is working just fine for me:

    http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=64533&epslanguage=en&pageIndex=2

    It's the last post by me on the page, perhaps this will help you.

    #65674 Feb 05, 2013 13:39
  • Tobias Lund
    Member since: 2013
     

    I think I've read that post a hundred times, but still couldn't figure out why it didn't work. After one last read I finally saw the difference.

    I've been giving the @Html.XForm method the parameters specified by: new XFormParameters() {SuccessAction = "Success", FailAction = "failure"}

    but it should be

    new {XFormParameters = new XFormParameters() {SuccessAction = "Success", FailAction = "failure"}

    Thaknk you!

    #65676 Feb 05, 2013 14:10