Answer the question
In order to leave comments, you need to log in
How to add a dynamic field with a value to a form?
Hello. There is a function:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#add').click(function(){
var str = '<div>';
str+= '<input type="text" value=""/> ';
str+= '<input type="button" value="-" class="remove"/>';
$('#sites').append(str);
});
$('.remove').live('click', function() {
$(this).parent('div').remove();
});
});
</script>
echo CHtml::openTag('div', ['id' => 'sites']);
echo CHtml::closeTag('div');
echo $form->dropDownList($door,'type',$door->typeList(),
['name' => DoorSale::class.'[type]['.$door->id.']']);
Answer the question
In order to leave comments, you need to log in
This is:
echo $form->dropDownList($door,'type',$door->typeList(),
['name' => DoorSale::class.'[type]['.$door->id.']']);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question