Dynamically inserted input elements not showing up in ActionResult's FormCollection parameter
I am adding input elements in a view, dynamically, using 开发者_Go百科JavaScript. But I am unable to find those inputs in my ActionResult's FormCollection
parameter...:
public ActionResult SomeAction(FormCollection fc)
I am able to find static input elements in the View. And using FireBug, I can see that the inputs are inside of the form element, in the DOM, and are not floating around somewhere random.
How can I access these inputs elements?
It is possible you're doing something to keep them from getting up to the server.
- are you changing the form's Action on the client? This causes the form values to not be posted to the server (as a browser security precaution).
- Remember to have a name attribute on the added elements.
- You're really posting the form, and not just refreshing?
Are the values available in the Request object?
精彩评论