0

My input pages have an OK and a Cancel button on them. These buttons are generated in a separate, partial view. The OK button is the submit for the form. The Cancel is a link to a different action. I can't make the Cancel button into a standard:

<form><input value="Cancel"></form>

as this would end up with nested forms which doesn't work (The form is on the outer, master view). I can use Javascript, but I was hoping to have a page that would work without it.
I tried:

 <a href="@Url.Action("DoStuff")"><button type="button">Stuff</button></a>

This works fine on Firefox, but does nothing on IE. Am I missing something here? Is there a simple way to get a button to work as a hyperlink?

2 Answers 2

1

You can always make the cancel button submit the form and make the redirect on the server side

Sign up to request clarification or add additional context in comments.

1 Comment

I was trying to avoid this, as it means the submit method has to handle the cancel. However, I have decided to use this method.
0

you could CSS-style your link to look like a button.

1 Comment

This runs the risk of the Cancel button looking different if the platform style changes for normal buttons. It's also messy getting the press effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.