London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Change or remove XForm action

Vote:
0

When implementing Html.BeginXForm to drop in a form, our code is adding a custom action attribute in order for the form to work with our system. So it looks like this:

Html.BeginXForm(Model.Form, new { Action = Model.ActionUri, data_abide = "", @class = @captchaClass })

If I take out the custom "Action = Model.ActionUri" in the htmlAttributes object, our forms do not work. So I want to replace the auto generated action with our custom one so that the form only gets one action attribute.

Is there a way to do this, and how?

#171533
Nov 09, 2016 17:06
Vote:
0

It's a bit hacky, but might work out for you:

ViewData["XFormParameters"] = new XFormParameters { PostAction = "blah" };
#171647
Nov 14, 2016 15:11
* 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.