Try our conversational search powered by Generative AI!

Change or remove XForm action

Vote:
 

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:
 

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.