开发者

Dynamically inserted input elements not showing up in ActionResult's FormCollection parameter

开发者 https://www.devze.com 2022-12-31 06:20 出处:网络
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...:

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消