Textarea值不出现在$ _POST对象上 [英] Textarea value not appearing on $_POST object
问题描述
我有这个网站,它基本上包含一些表格由用户填写。然后,用户可以以可读的格式(pdf)或机器可读的格式(xml)下载这些信息,但我在提交文本框时遇到了一些问题。
我有一个其中很少,例如在描述部分,但是当我访问$ _POST ['Desc_Desc_desc']值时,即使我可以在textarea上看到内容,它也是空的。奇怪的是,当我使用萤火虫检查元素时,它显示元素就好像它没有内容。
任何人都可以判断是什么导致了这种奇怪的行为?
service_level_library.buttons.prepForSubmit
中,textarea被克隆以及通过DOM cloneNode
方法。这会复制HTML元素属性,但不会复制DOM属性。 (有时,DOM元素节点属性的相应的属性,因此更新属性会影响属性,这可能会使DOM属性被复制。) 虽然 textarea DOM对象有一个 要修复脚本,请执行以下任一操作: Guys, im scratching my head around this one. I have this website that basically contains a few forms that are filled in by the user. The user then can download that information in human readable format (pdf) or machine readable format (xml) but I'm having a slight problem submitting textboxes. I have a few of them, for instance in the description section, but when i access the $_POST['Desc_Desc_desc'] value, it's empty even though i can see content on the textarea. The weird thing is that when i use firebug to inspect the element, it shows the element as if it had no contents.. Can anyone figure what is causing this strange behavior? In While textarea DOM objects have a To fix your script, do one of:
这篇关于Textarea值不出现在$ _POST对象上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! value
属性,< a href =http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.7 =nofollow> textarea HTML元素不会具有相应的值
属性,因此值
属性不会公开属性。因此,当你克隆节点时,(空的)值
属性被复制,留下当前值(可通过值$ c $访问
li>克隆后复制值。
在编程前用编程方式替换文本区域(尽管这会比其他选项更为复杂)service_level_library.buttons.prepForSubmit
, the textarea is cloned along with the rest of the form via the DOM cloneNode
method. This copies HTML element attributes, but not DOM properties. (Sometimes DOM element node properties have a corresponding attribute, so updating the property affects the attribute, which can make it appear that DOM properties are being copied.)value
property, the textarea HTML element doesn't have a corresponding value
attribute, so the value
property isn't exposing an attribute. Thus when you clone the node, the (empty) value
attribute is what gets copied, leaving the current value of the element (as accessible via the value
property) behind.
defaultValue
property or setting the text content of the node, before cloning. This works because the current value of the cloned node will be set to its initial value, and a deep copy of a textarea will copy its text contents (the source of its initial value).