2013-01-09 65 views
0

当我运行下面的代码段并点击'submit'时,'price'不会被发布;有什么我忘了吗?dojo dojo.behavior values not posting

<?php 
var_dump($_POST); 
?> 
<!DOCTYPE html> 
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<link rel="stylesheet" href="libs/dijit/themes/claro/claro.css"> 
<script>dojoConfig = {async: true}</script> 
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.3/dojo/dojo.js"></script> 
</head> 
<body class="claro"> 
<form id="myform" method="post" action="index.php"> 
    <input class="cif" name="price" type="text" value="125.10" /> 
    <input type="submit" value="submit" name="submit"> 
</form> 
<script type="text/javascript"> 
require(["dojo/ready", "dijit/form/NumberTextBox", "dojo/behavior"], 
    function(ready, box, behavior){ 
     ready(function(){  
     behavior.add({ 
      '.cif': function(node) { //assumes "found" 
       new box({constraints: {pattern: "###,###.00"}, value: dojo.number.format(node.value, {places:2})},node);       
     } 
     }); 
     behavior.apply(); 
    });  
}); 
</script> 
</body> 
</html> 

对不起,这个新手的问​​题

埃里克

+0

你得到任何错误?

0

最近我遇到了类似的问题,只有这个结果,我发现但机智h没有答案。但今天我知道了,所以我会分享我的知识。

当您创建一个新的窗口小部件框时,您还需要定义'name'属性,否则该窗口小部件将生成隐藏的输入,并且在发布时不需要“name”属性。

改变这一行:

new box({constraints: {pattern: "###,###.00"}, value: dojo.number.format(node.value, {places:2}), name: "price"},node); 

特丽克丝

相关问题