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

Hello,

I have two fields, field1 is a checkbox and field2 is normal text field. I want to hide a field2 if a field1 is not checked and if 

field1 is checked then show field2. For that, I am creating following code: 


odoo.define('survey_inherit.FormView', function (require) {
"use strict";

var FormView = require('web.FormView');
var core = require('web.core');
var QWeb = core.qweb;

var FormView = FormView.extend({
_checkField: function(){

var $checkbox = $('.custom-control-input').val();

if ($checkbox.is(':checked')) {

$('.o_form_label').show();
$('.mandatory_msg_class').show();
}else{

$('.mandatory_msg_class').hide();
}//close else
},
});//close FormController

return FormView; 
});

But field2 is not hide if field1 is not checked and also field2 is not shown if field1 is checked.

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

can anyone please share any idea. I am doing the last 2-3 days but didn't achieve it.

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ธ.ค. 19
2987
1
ก.พ. 23
5317
1
เม.ย. 22
2657
0
ม.ค. 20
3516
2
มิ.ย. 24
3300