我使用JQuery我在哪里尝试使用CakePHP的控制器在JQuery的input元素的返回值..对于JQuery的
我从我的CakePHP控制器操作返回两个变量 $项目和$属性.. $属性将返回字段名及其类型,大小为 $条目将返回字段名和为该字段提交的值。
两者都是数组变量 在这里,我已经创建使用
<?php foreach ($attributes as $r): ?>
$("<div id= <?php echo $r['Attribute']['label'];?> ></div>").appendTo("#main");
$("<input id=input<?php echo $r['Attribute']['id'];?> type= 'text' style= 'width:<?php echo $r['Attribute']['size'];?>px'value='<?php echo $attribute['Result']['value'];?>' ?> ></input><br>").appendTo("#main");
$("<div id= <?php echo $r['Attribute']['type'];?> ></div>").appendTo("#main");
<?php endforeach; ?>
在上面的代码中,我创造它显示我基于它。但是内正确输入元素的输入元素对应的输入元素当我试图使用像 值= '' 输入元件?>
我必须保持
<?php endforeach;?>
其中这里面只有我能使用
怎么做。请给我建议.. 因为两者都是循环我不知道如何使用它们,因为当我保持 将作为创建多次数..
<script type="text/javascript">
$(document).ready(function(){
$(".edi").click(function(){
<?php foreach ($attributes as $r): ?>
$("<div id= <?php echo $r['Attribute']['label'];?> ></div>").appendTo("#main");
$("<input id=input<?php echo $r['Attribute']['id'];?> type= 'text' style= 'width:<?php echo $r['Attribute']['size'];?>px'value='<?php echo $attribute['Result']['value'];?>' ?> ></input><br>").appendTo("#main");
$("<div id= <?php echo $r['Attribute']['type'];?> ></div>").appendTo("#main");
<?php endforeach; ?>
$(".edi").hide();$(".vie").show();
return false;
});
});
</script>
编辑: 我一直 为retriving从属性表中的字段(类型,大小,字段名).. 是retriving的,表格中的条目(标签,值)...
在点击编辑按钮,,,我生成与尺寸的输入元件,其中i从$ R [“属性”] [“尺寸”]得到它作为
$(”类型=‘文本’ style ='width:px'value =''?>>
“).appendTo(”#main“); 这显示了正确的输入元素的正确大小,它从表中检索到的正确大小。
现在在这个ie中,在Input元素中,我想显示这个对应的字段的值, $ R1 [ '结果'] [ '值']; 这是我不能够让这个值显示里面输入Elements..Please帮我......
请写出的HTML/Javascript代码结果foreach – 2009-08-25 13:15:22
考虑编辑你的文章的后半部分。这句话是不完整的。我不太明白为什么你有php和js代码混合。最终的结果是什么? – krishna 2009-08-25 13:17:49
编辑帖子 – useranon 2009-08-27 10:27:15