Telerik MVC 控件 - 在 js 中序列化 NumericTextBox
在我的表单上,我有 Telerik NumericTextBox:
@Html.Telerik().CurrencyTextBoxFor(p => p.Item.Amount)
并且 javascript 将该表单发送到控制器:
var formData = $("form").serializeArray();
$.post("@Url.Content("~/Diary/Add")", formData );
我的问题是,CurrencyTextBox 没有被序列化并发送到服务器。我知道为什么会发生这种情况 - 该控件由 2 个输入组成,名称和 ID 混乱,因此序列化程序无法将其识别为“成功的控件”( http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2 ).
有谁知道是否有任何解决办法,没有任何令人讨厌的黑客(例如手动将该值添加到数组中)?
On my form, I've got Telerik NumericTextBox:
@Html.Telerik().CurrencyTextBoxFor(p => p.Item.Amount)
and javascript sends that form to the controller:
var formData = $("form").serializeArray();
$.post("@Url.Content("~/Diary/Add")", formData );
My problem is, that the CurrencyTextBox doesn't get serialized and sent to the server. I know why it's happening - this control is made of 2 inputs, with messed up names and IDs, so serializer doesn't recognize it as a "successful control" ( http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2 ).
Does anybody know if there is any way around it, without any nasty hacks (like manually adding that value to the array)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试使用更新的版本。数字文本框现在只有一个
。
You can try using a more up-to-date version. The numeric textbox has only one
<input />
now.