Yii Framework Forum: How To Display Checkboxlist Based On Selected Dropdownlist - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Display Checkboxlist Based On Selected Dropdownlist Rate Topic: -----

#1 User is offline   NewMember 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 20-June 14

Posted 22 July 2014 - 08:32 PM

Hi Yii-ers.

For example, I have this attribute in my table
id, id_karyawan, id_barang

I want to display this in my form :
id_karyawan --> dropdownlist
after selected id_karyawan, I want to display checkboxlist "id_barang" based on "id_karyawan" selected

Anyone can help me,

Thank you
0

#2 User is offline   dragan.zivkovic 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 13-September 12

Posted 23 July 2014 - 12:50 AM

This is more jQuery than Yii problem, maybe this could help:
add event listener on your select element. On change U can have selected value, based on what U can do your logic and just append id_barang checkbox in your form
something like this:

$('#karywan_select').on('change', function() {
var idKarywan = $('option:selecte', $(this)).val();
// than do yor procedure to get id_barang
// and when U are ready
$('#yourForm').append('<input type="checkbox" value="id_barang"/>');

})
0

#3 User is offline   NewMember 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 20-June 14

Posted 23 July 2014 - 08:47 PM

View Postdragan.zivkovic, on 23 July 2014 - 12:50 AM, said:

This is more jQuery than Yii problem, maybe this could help:
add event listener on your select element. On change U can have selected value, based on what U can do your logic and just append id_barang checkbox in your form
something like this:

$('#karywan_select').on('change', function() {
var idKarywan = $('option:selecte', $(this)).val();
// than do yor procedure to get id_barang
// and when U are ready
$('#yourForm').append('<input type="checkbox" value="id_barang"/>');

})


Thank you dragan.zivkovic, I will try this
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users