Ok, I have made much progress in getting this working.
The dropdown calls the loadTemplate function which returns the data in JSON format.
The text fields get updated beautifully, but the checkboxes do not even though the right info gets sent via json:
JSON response:
{"client_id":"7","extension":"0002","name":"Template2","accountcode":"00101","number":"0123456789","type":"1","context":"public","host":"dynamic","disallow":"all","canreinvite":"1","secret":"mysecret","dtmfmode":"1","qualify":"0","jbmaxsize":"300","jbforce":"0","mac":"","hasvoicemail":"0","istemplate":"1","template_id":"6"}
View file:
<?php
echo $form->dropDownList($model,'template_id',CHTML::listData(Sipconf::model()->findAllByAttributes(array('istemplate'=>'1')),'client_id','name'),
array(
'ajax' => array(
'type' => 'post',
'dataType' => 'json',
'url'=> CController::createUrl('sipconf/loadtemplate'),
'success'=>'function(data){
$("#Sipconf_extension").val(data.extension);
$("#'.CHTML::activeId($model,'name').'").val(data.name);
$("#'.CHTML::activeId($model,'number').'").val(data.number);
$("#'.CHTML::activeId($model,'accountcode').'").val(data.accountcode);
$("#'.CHTML::activeId($model,'context').'").val(data.context);
$("#'.CHTML::activeId($model,'dtmfmode').'").val(data.dtmfmode);
$("#'.CHTML::activeId($model,'hasvoicemail').'").val(data.hasvoicemail);
$("#'.CHTML::activeId($model,'host').'").val(data.host);
$("#'.CHTML::activeId($model,'istemplate').'").val(data.istemplate);
$("#'.CHTML::activeId($model,'jbforce').'").val(data.jbforce);
$("#'.CHTML::activeId($model,'jbmaxsize').'").val(data.jbmaxsize);
$("#'.CHTML::activeId($model,'mac').'").val(data.mac);
$("#'.CHTML::activeId($model,'qualify').'").val(data.qualify);
$("#'.CHTML::activeId($model,'canreinvite').'").val(data.canreinvite);
}'
)
)
);
?>
any ideas on how to get the "canreinvite" checkbox to update with the right value?