Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Select others, then show input text in Laravel
Everything works when picking up others, but I get an error when choosing another option. Please help,, i'm newbie in laravel
<select id="position" class="form-control" name="position" onchange='checkvalue(this.value)'>
<option value="Option A">Gedung A</option>
<option value="Option B">Option B</option>
<option value="Option C">Option C</option>
<option>Other...</option>
</select>
<input type="text" id="other_text" class="form-control" name="position" placeholder="Enter your location" required style='display:none' />
<script>
function checkvalue(val)
{
if(val==="Other...")
document.getElementById('other_text').style.display='block';
else
document.getElementById('other_text').style.display='none';
}
</script>
0
2 Jawaban:
Error nya apa? klo pilih selain yang order input nya ga muncul? klo iya, kan fungsi js nya nyuruh gitu...
0
Value selectnya tidak bisa tersimpan (null) ke database, kecuali value yg diisi dari inputnya. Misal: pilih->other->isi input-> save success pilih->option a -> errornya gini ; 'cannot save null value'
0