[FIX] RECRUITMENT: Survey question forms erros showed, options toggle fixed
This commit is contained in:
@@ -684,7 +684,7 @@ class QuestionForm(ModelForm):
|
||||
options = self.cleaned_data["options"]
|
||||
if not recruitment.exists(): # or jobs.exists()):
|
||||
raise ValidationError(
|
||||
"Choose any recruitment or job positions to apply this question"
|
||||
{"recruitment": _("Choose any recruitment to apply this question")}
|
||||
)
|
||||
self.recruitment = recruitment
|
||||
# self.job_positions = jobs
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<form
|
||||
hx-post="{% url 'recruitment-survey-question-template-create' %}"
|
||||
hx-target="#addSurveyModalBody"
|
||||
hx-target="#templateModalBody"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %} {{form.as_p}}
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
function toggleOpt(){
|
||||
if ($("[name=type]:first").val() == "options" || $("[name=type]:first").val() == "multiple") {
|
||||
$("#id_options, [for='id_options']").show();
|
||||
} else {
|
||||
$("#id_options, [for='id_options']").hide();
|
||||
}
|
||||
function toggleOpt() {
|
||||
if ($("#templateModalBody form [name=type]").first().val() == "options" || $("#templateModalBody form [name=type]").first().val() == "multiple") {
|
||||
$("#id_options, [for='id_options']").show();
|
||||
} else {
|
||||
$("#id_options, [for='id_options']").hide();
|
||||
}
|
||||
$("[name=type]:first").change(function (e) {
|
||||
toggleOpt()
|
||||
});
|
||||
toggleOpt()
|
||||
}
|
||||
|
||||
});
|
||||
$("[name=template_id]").parent().removeClass("col-md-6").addClass("col-md-12")
|
||||
$("#templateModalBody form [name=type]").change(function (e) {
|
||||
toggleOpt();
|
||||
});
|
||||
|
||||
// Call toggleOpt on page load to set the initial state
|
||||
$(document).ready(function() {
|
||||
toggleOpt();
|
||||
});
|
||||
|
||||
$("#templateModalBody form [name=template_id]").parent().removeClass("col-md-6").addClass("col-md-12")
|
||||
</script>
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
<form
|
||||
hx-post="{% url 'recruitment-survey-question-template-edit' form.instance.id %}"
|
||||
hx-target="#addSurveyModalBody"
|
||||
hx-target="#updateSurveyModalBody"
|
||||
method="post"
|
||||
>
|
||||
{% csrf_token %} {{form.as_p}}
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
function toggleOpt(){
|
||||
if ($("[name=type]:first").val() == "options" || $("[name=type]:first").val() == "multiple") {
|
||||
$("#id_options, [for='id_options']").show();
|
||||
} else {
|
||||
$("#id_options, [for='id_options']").hide();
|
||||
}
|
||||
function toggleOpt() {
|
||||
if ($("#updateSurveyModalBody form [name=type]").first().val() == "options" || $("#updateSurveyModalBody form [name=type]").first().val() == "multiple") {
|
||||
$("#id_options, [for='id_options']").show();
|
||||
} else {
|
||||
$("#id_options, [for='id_options']").hide();
|
||||
}
|
||||
$("[name=type]:first").change(function (e) {
|
||||
toggleOpt()
|
||||
});
|
||||
toggleOpt()
|
||||
}
|
||||
|
||||
});
|
||||
$("[name=template_id]").parent().removeClass("col-md-6").addClass("col-md-12")
|
||||
$("#updateSurveyModalBody form [name=type]").change(function (e) {
|
||||
toggleOpt();
|
||||
});
|
||||
|
||||
// Call toggleOpt on page load to set the initial state
|
||||
$(document).ready(function() {
|
||||
toggleOpt();
|
||||
});
|
||||
|
||||
$("#updateSurveyModalBody form [name=template_id]").parent().removeClass("col-md-6").addClass("col-md-12")
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user