Reputation: 4791
I am trying to add the id to a submit form and the codes are written using Sitecore:
@using (Html.BeginForm())
{
@Html.Sitecore().FormHandler("Payment", "Submit");
}
I have one controller called Payment Controller and uses the submit function inside of the controller. But now I want to add the id to the form, when I try:
@using (Html.BeginForm(null,null, FormMethod.Post, new { id = "FormFinalize" } ))
{
@Html.Sitecore().FormHandler("Payment", "Submit");
}
It looks like some function breaks.. Anyone has any idea how to correctly add the id to the form? Thanks.
Upvotes: 2
Views: 656
Reputation: 377
I would suggest using this code:
@using (Html.BeginForm("Submit", "Payment", FormMethod.Post, new { id = "FormFinalize" } ))
{
<button type="submit">Submit</button>
}
Upvotes: 0
Reputation: 1228
You need @ sing before the id or any other attribute you need to add like name,class and so on
@using (Html.BeginForm(null,null, FormMethod.Post, new { @id = "FormFinalize" } ))
{
@Html.Sitecore().FormHandler("Payment", "Submit");
}
Upvotes: 1