Excuse me, I'm just learning web developing recently,
I have some trouble on dynamic form, here's the picture
I wanna make dynamic form with select type on it.
TAMBAH button = add more field Simpan button = save,
The problem is, when I want to add more fields, select input did not show as the first one, it become normal input not select.
I know, maybe the problem is from javascript which I don't understand.
here is the code
On Form
<td>{{ Form::text('jumlah[]', null, array('class'=>'form-control')) }}</td>
<td>{{ Form::text('satuan[]', null, array('class'=>'form-control')) }}</td>
<td>{{ Form::text('keterangan[]', null, array('class'=>'form-control')) }}</td>
{{ Form::select('status_pi[]', ['Iya' => 'iya', 'Tidak' => 'Tidak'],
'Tidak',array('class'=>'form-control')) }}
On Javascript
var jumlah = document.createElement('input');
jumlah.setAttribute('name', 'jumlah[' + i + ']');
jumlah.setAttribute('class', 'form-control');
var satuan = document.createElement('input');
satuan.setAttribute('name', 'satuan[' + i + ']');
satuan.setAttribute('class', 'form-control');
var keterangan = document.createElement('input');
keterangan.setAttribute('name', 'keterangan[' + i + ']');
keterangan.setAttribute('class', 'form-control');
var status_pi = document.createElement('input');
status_pi.setAttribute('name', 'status_pi[' + i + ']');
status_pi.setAttribute('selected', 'selected');
status_pi.setAttribute('class', 'form-control');
I wanna make var status_pi field appear like on the first one below PI column,
Pls help sensei