<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'address-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
$imghelp1 = CHtml::image(Yii::app()->request->baseUrl . '/images/help.png');
echo CHtml::link($imghelp1, '#', array('style' => 'cursor: pointer; text-decoration: underline;', 'onclick' => "{helpdata(4)}"));
echo $form->hiddenField($model, 'addressid');
echo $form->hiddenField($model, 'addressbookid');
?>
	<p class="note">Fields with <span class="required">*</span> are required.</p>

    <div class="row">
		<?php 
echo $form->labelEx($model, 'addresstypeid');
echo $form->hiddenField($model, 'addresstypeid');
?>
          <input type="text" name="addresstype_name" id="addresstype_name" readonly value="<?php 
echo Addresstype::model()->findByPk($model->addresstypeid) !== null ? Addresstype::model()->findByPk($model->addresstypeid)->addresstypename : '';
?>
">
          <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'addresstype_dialog', 'options' => array('title' => Yii::t('app', 'Address Type'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$addresstype = new Addresstype('searchwstatus');
$addresstype->unsetAttributes();
// clear any default values
if (isset($_GET['Addresstype'])) {
    $addresstype->attributes = $_GET['Addresstype'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'addresstype-grid', 'dataProvider' => $addresstype->Searchwstatus(), 'filter' => $addresstype, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
                array("name" => "send_addresstype",
                "id" => "send_addresstype",
                "onClick" => "$(\\"#addresstype_dialog\\").dialog(\\"close\\"); $(\\"#addresstype_name\\").val(\\"$data->addresstypename\\"); $(\\"#Bankaddress_addresstypeid\\").val(\\"$data->addresstypeid\\");"))'), 'addresstypeid', 'addresstypename', array('class' => 'CCheckBoxColumn', 'name' => 'recordstatus', 'selectableRows' => '0', 'header' => 'Record Status', 'checked' => '$data->recordstatus'))));
$this->endWidget('zii.widgets.jui.CJuiDialog');
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Addresstype::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }