[FIX] PMS: questionTypeChange function update
This commit is contained in:
17
pms/forms.py
17
pms/forms.py
@@ -875,14 +875,15 @@ class QuestionForm(ModelForm):
|
||||
|
||||
model = Question
|
||||
exclude = ["question_option_id", "template_id", "is_active"]
|
||||
# widgets = {
|
||||
# "question_type": forms.Select(
|
||||
# attrs={
|
||||
# "class": "oh-select oh-select--sm oh-select-no-search oh-select--qa-change w-100",
|
||||
# "required": True,
|
||||
# }
|
||||
# )
|
||||
# }
|
||||
widgets = {
|
||||
"question_type": forms.Select(
|
||||
attrs={
|
||||
"class": "oh-select oh-select--sm oh-select--qa-change w-100",
|
||||
"required": True,
|
||||
"onchange": "questionTypeChange($(this))",
|
||||
}
|
||||
)
|
||||
}
|
||||
fields = "__all__"
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -119,6 +119,14 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function questionTypeChange(element) {
|
||||
if (element.val() === "4") {
|
||||
$(element).parents().siblings('.oh-link__expanded').removeClass('d-none');
|
||||
} else {
|
||||
$(element).parents().siblings('.oh-link__expanded').addClass('d-none');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user