HTML输入字段禁用输入,但仍然是POST [英] HTML input field disable input but still POST

查看:165
本文介绍了HTML输入字段禁用输入,但仍然是POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上我想要一个禁用文本字段来显示存储在数据库中的值,但我不希望它可以被用户编辑。



我已经尝试使用 disabled =disabled,但不再发布到我的表单处理程序...



任何建议?



感谢

解决方案

$ b $


在这个例子中,INPUT元素被禁用
。因此,它不能收到
的用户输入,也不会收到
的表单。


为什么你需要价值?然后尝试只读 - 属性而不是禁用或者转到另一个隐藏字段。



编辑:

如果您使用asp.net,则不完全清楚,如果是,则可以执行

 < form submitdisabledcontrols =truerunat =server> 

你可以试一下:)

Basically i want a disable text field to show the value stored in a database but i don't want it to be editable by the user.

i've tried using disabled="disabled" but then it no longer POST to my form handler...

Any suggestions?

thanks

解决方案

docu:

In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.

why do you need the value? then try the readonly-attribute instead of disabled or go for another hiddenfield.

edit:
it's not fully clear to me, if you use asp.net, bu if so, you could just do

<form submitdisabledcontrols="true" runat="server">

you may give it a try :)

这篇关于HTML输入字段禁用输入,但仍然是POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆