【Sciter】不要尝试对表单中的隐藏项赋值

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/aqtata/article/details/77987410
<html>
<head>
	<script type="text/tiscript">
		self.on("click", "#b", function(evt) {
			$(#frm).value = {name:"hello"};
			//$(#out).value = JSON.stringify($(#frm).value, " ");
			$(#out).value = String.printf("%V", $(#frm).value);
		});
	</script>
</head>
<body>
<form#frm><input|hidden(name)/></form>
<button#b>reset</button>
<pre#out/>
</body>
</html>

上面的代码将会输出

{name:undefined}

也就是说,对表单中的hidden类型的项赋值会失败。

一开始我以为这是一个BUG,就向作者反馈了这个问题,但作者的回复说就是这么设计的。。。所以,如果碰到相同问题的朋友需要使用其他方法绕开这个限制了

反馈讨论地址:https://sciter.com/forums/topic/form-can-not-set-the-hide-value

猜你喜欢

转载自blog.csdn.net/aqtata/article/details/77987410