tags:

views:

364

answers:

2

Hi, I have a strange problem happening today. I am running the latest version of the MVC V2 framework and have been having no trouble at all - I came in this morning and for some reason values aren't being passed in to actions.

To clarify lets say I have something like this:

<% using (Html.BeginForm("Register", "Registration", FormMethod.Post)) { %>
....
<input type="submit" name="register" id="register" value="Register" />
<% } %>

And in my controller I have the following:

[HttpPost]
public ActionResult Register(RegistrationModel model, string register)
{
      // At this point the register string is null
}

This has been working fine for a while now and I have not changed anything that I can think of that would cause this to happen.

Does that make sense and as anyone any idea what is going on or what I have messed up?

Thanks.

+1  A: 

"Not changed anything", Well most of the time code doesn't work differently just because its Friday instead of Thursday.

" I can think of that would cause"

So you changed something, undo those changes one by one and see what happens.

Something must have changed. Do you have a custom model binder that you were working on? Did you add a route that may catch the one your posting too?

jfar
I have seen plenty of situations where an apparently unrelated change can be the cause of a problem. +1 for backing out some recent changes and see what happens.
Swoop
No code changes have been made at all - what I have been working on is changing the theme - so in that respect the ONLY thing that has changed are CSS files. How would that effect the form submits?
Wayne
I don't know what to say then. Code just doesn't turn off. You changed something, maybe you don't remember. Post the html output that your using.
jfar
+1  A: 

Turns out I really hadn't made any code changes. It was indeed the theme that I was using for the site. Long story short it came with a JavaScript file to various things and tucked away at the bottom of the file was a function to skin the buttons - once I had removed that line it worked just fine.

Wayne
Two things I've discovered. 1. Can't use this method for image buttons (which is why the skin broke it). 2. Must have the 'name' attribute of the button set.
Rake36