Advertisement
Guest User

form

a guest
Jul 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. <?php
  2.  
  3. use yii\helpers\Html;
  4. use yii\widgets\ActiveForm;
  5.  
  6. /* @var $this yii\web\View */
  7. /* @var $model app\models\User */
  8. /* @var $form yii\widgets\ActiveForm */
  9. ?>
  10.  
  11. <div class="user-form">
  12. <?php $form = ActiveForm::begin(); ?>
  13.  
  14. <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
  15.  
  16. <?php //$form->field($model, 'email')->textInput(['maxlength' => true]) ?>
  17.  
  18. <?= $form->field($model, 'nama_lengkap')->textInput(['maxlength' => true]) ?>
  19.  
  20. <?= $form->field($model, 'alamat')->textInput(['maxlength' => true]) ?>
  21.  
  22. <?= $form->field($model, 'no_hp')->textInput(['maxlength' => true]) ?>
  23.  
  24. <?php if ($model->isNewRecord): ?>
  25. <?= $form->field($model, 'item_name')->dropDownList($listRole, ['prompt' => 'Pilih']) ?>
  26. <?php else: ?>
  27. <?= $form->field($model, 'item_name')->dropDownList($listRole, ['options' => [$authAssignments[0] => ['selected'=>'selected']]]) ?>
  28.  
  29. <?= $form->field($model, 'status')->dropDownList($model->status_list, ['prompt' => 'Pilih']) ?>
  30. <?php endif ?>
  31.  
  32. <?= $form->field($model, $model->isNewRecord ? 'password_hash' : 'new_password')
  33. ->passwordInput([
  34. 'maxlength' => true,
  35. 'placeholder' => $model->isNewRecord ? '' : 'Isi jika ingin merubah password pengguna'
  36. ])
  37. ?>
  38.  
  39. <div class="form-kendaraan">
  40.  
  41. </div>
  42.  
  43. <?php //$form->field($model, 'auth_key')->textInput(['maxlength' => true]) ?>
  44.  
  45. <?php //$form->field($model, 'password_reset_token')->textInput(['maxlength' => true]) ?>
  46.  
  47. <?php //$form->field($model, 'account_activation_token')->textInput(['maxlength' => true]) ?>
  48.  
  49. <?php //$form->field($model, 'status')->textInput() ?>
  50.  
  51. <?php //$form->field($model, 'created_at')->textInput() ?>
  52.  
  53. <?php //$form->field($model, 'updated_at')->textInput() ?>
  54.  
  55. <div class="form-group">
  56. <?= Html::submitButton($model->isNewRecord ? 'Simpan' : 'Perbarui', ['class' => 'btn btn-success']) ?>
  57. <?= Html::a('Kembali',$model->isNewRecord ? ['index'] : ['view', 'username' => $model->username], ['class' => 'btn btn-danger']); ?>
  58.  
  59. <?= Html::button('Detail Kendaraan', ['class' => 'btn btn-info', 'id' => 'kendaraan']); ?>
  60. </div>
  61.  
  62. <?php ActiveForm::end(); ?>
  63.  
  64. </div>
  65.  
  66. <?php
  67.  
  68. $formEmail = $form->field($model, 'email')->textInput(['maxlength' => true]);
  69. $this->registerJs('
  70. $("document").ready(function(){
  71. var userForm = $(".form-kendaraan");
  72. var add_button = $("#kendaraan");
  73. var form = "'.$formEmail.'";
  74.  
  75. $(add_button).click(function(e){
  76. e.preventDefault();
  77. $(userForm).append(form);
  78. });
  79. });
  80. ');
  81.  
  82. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement