Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4927 มุมมอง

Hey i need a little guidance about how to check the value of a radio button which is in a form in portal and i want the selected radio button to populate in the model while confirming.

Here is my code of passing rest of the data but m unable to pass the radio button. Got any idea?

    _create_advance: function () {
return this._rpc({
model: 'hr.advance.salary',
method: 'create_advance_portal',
// var pay = document.getElementById('payment').checked;
// var result= pay.value;
// if (result === true) {
// console.log('Partially');
// new_result = $('.new_advance_form .partially').val();
// }
// else{
// new_result = $('.new_advance_form .fully').val();
// }

args: [{
request_amount: $('.new_advance_form .request_amount').val(),
// payment: new_result, This was my radio button
payment_start_date: $('.new_advance_form .payment_start_date').val(),
reason: $('.new_advance_form .reason').val(),

}],
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You will have to fetch the checked radio/element for each field as follow:

var gender = $("input[name='gender']:checked").val();


อวตาร
ละทิ้ง
ผู้เขียน

Hey thanks for replying.Selection field name is payment and its two values are partially and fully so i should use payment instead of gender?

ผู้เขียน

Thank you so much its working

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 18
4834
0
ส.ค. 23
194
1
มิ.ย. 23
2904
Odoo use which javascript framework? แก้ไขแล้ว
1
ก.พ. 22
2877
0
ส.ค. 18
5846