如何从多个选择中获取价值
<select name="role" id="role" class="ui fluid search dropdown" multiple="multiple">
<option value="">Role</option>
<option value="dekanat">Dekanat</option>
<option value="dosen_bisnis">Dosen Jurusan Bisnis</option>
<option value="dosen_publik">Dosen Jurusan Publik</option>
<option value="staff_tu">Staff Tata Usaha</option>
<option value="staff_bisnis">Staff Jurusan Bisnis</option>
<option value="staff_publik">Staff Jurusan Publik</option>
</select>
如何获取服务器端的值?我试过这个,但它不起作用。它返回undefined
module.exports.list_email_insert_post = function(req, res) {
var test = req.body.role;
console.log(test);
}
答案 0 :(得分:0)
您必须使用数组来获取多个选择数据
<select name="role[]" id="role" class="ui fluid search dropdown" multiple="multiple">
<option value="">Role</option>
<option value="dekanat">Dekanat</option>
<option value="dosen_bisnis">Dosen Jurusan Bisnis</option>
<option value="dosen_publik">Dosen Jurusan Publik</option>
<option value="staff_tu">Staff Tata Usaha</option>
<option value="staff_bisnis">Staff Jurusan Bisnis</option>
<option value="staff_publik">Staff Jurusan Publik</option>
</select>