@ -4,6 +4,6 @@ module ConditionalQuestionsHelper
end
def display_question_key_div(page, question)
"style='display:none;'".html_safe if conditional_questions_for_page(page).include?(question.id)
"style='display:none;'".html_safe if conditional_questions_for_page(page).include?(question.id) || question.requires_js
@ -3,7 +3,7 @@ class Form::Question
:type, :min, :max, :step, :width, :fields_to_add, :result_field,
:conditional_for, :readonly, :answer_options, :page, :check_answer_label,
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value,
:guidance_partial, :prefix, :suffix
:guidance_partial, :prefix, :suffix, :requires_js
def initialize(id, hsh, page)
@id = id
@ -26,6 +26,7 @@ class Form::Question
@hidden_in_check_answers = hsh["hidden_in_check_answers"]
@prefix = hsh["prefix"]
@suffix = hsh["suffix"]
@requires_js = hsh["requires_js"]
@page = page
@ -1,6 +1,13 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
const affectedField = this.element.dataset.target;
const targetQuestion = affectedField.split("case-log-")[1].split("-field")[0]
const div = document.getElementById(targetQuestion + "_div");
div.style.display = "block";
}
calculateFields() {
const fieldsToAdd = JSON.parse(this.element.dataset.calculated).map(x => `case-log-${x.replaceAll("_","-")}-field`);
@ -2018,7 +2018,8 @@
"type": "numeric",
"min": 0,
"step": 1,
"readonly": true
"readonly": true,
"requires_js": true
},
"hbrentshortfall": {
"check_answer_label": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?",