0

I have a simple form where I would like to append a hash variable to the end of the action. My code looks like this:

@using(Html.BeginForm(MVC.Checkout.Index(), FormMethod.Post))
{
    //Form stuff here
}

Which renders:

<form action="/Checkout" method="post">

When the form is rendered I would like it to be:

<form action="/Checkout#someParam" method="post">

Is this possible with T4MVC?

ilivewithian
  • 19,476
  • 19
  • 103
  • 165
  • why not just post the parameters on a normal form post in the form collection? You would have to modify your routing to do something like what you have posted. – Ryand.Johnson Feb 16 '12 at 16:35
  • I want the # so that when the form comes back it will scroll to the correct part of the page (when I can't use javascript for an ajax post) – ilivewithian Feb 16 '12 at 16:41
  • How does that normally in MVC when using (non-T4MVC) Html.BeginForm()? – David Ebbo Feb 17 '12 at 00:50
  • It turns out you can't do it directly, you have to create the form by hand and set the action to a url.action and then append the hash by hand. – ilivewithian Feb 18 '12 at 10:31

1 Answers1

1

As per my question regarding this problem David Ebbo updated T4MVC to support this.

You can now use the following in an ActionLink:

@Html.ActionLink("Product Details", Html.GetTestActionResult(Model.ProductId), new { @class = "button blue" }, fragment: "#tab-similar-products")
Community
  • 1
  • 1
Rebecca
  • 13,914
  • 10
  • 95
  • 136