0
jQuery 아약스 내에 새로운 ZF2'Zend \ Form \ Element를 추가하고 싶습니다. 그러나 Zend Form을 사용하는 동안 나는 그것을 만드는 방법을 모른다. 이것은 add.phtml 파일입니다. 다음은jQuery 아약스 내에서 새로운 ZF2 'Zend Form Element를 추가하는 방법
<script type="text/javascript">
$(document).ready(function(){
$(".pid").change(function(){
var id = $('.pid').val();
var $_this = $(this);
$.ajax({
type:"POST",
url:"<?php echo $this->url('Element/default',array('action'=>'change'));?>",
data:"pid="+id,
dataType:'json',
async:false,
success:function(data){
if(data.response){
//here I want to add a new select component after select conponent "pid" using like "$this->formRow($form->get('mid'))" or else .
}
}
});
});
});
</script>
되는 HTML의 나머지 부분이다.
<?php
$title = 'add';
$this->headTitle($title);
?>
<h1><?php echo $this->escapeHtml($title); ?></h1>
<?php
$form = $this->form;
$form->setAttribute('action', $this->url(
'Element/default',
array(
'action' => 'add'
)
));
$form->prepare();
echo $this->form()->openTag($form);
echo $this->formRow($form->get('pid'));
echo $this->formRow($form->get('name'));
echo $this->formRow($form->get('desc'));
echo $this->formSubmit($form->get('submit'));
echo $this->form()->closeTag();
jquery ajax 내에 새로운 zend 양식 요소를 어떻게 추가합니까? 감사.
난 게으른 해요,하지만 그것은 모두 여기에서 설명 된 것 죄송합니다 : http://www.michaelgallego.fr/blog/2012/07/ 04/new-zendform-features-described/ – Sam
웹 사이트를 열지 못했습니다. – Leo
아마도 도움이 될 것입니다 : http://framework.zend.com/manual/2.0/en/modules/zend.form.collections.html # adding-new-elements-dynamically – Andy0708