Hi, I am trying to add a textarea for a single option in an Array question.
To achieve this,
1. I added 2 questions: 1-> Array; 2 -> LongFreeText
2. Added <span id="subQn2describe"> tag for Array subquestion where I need TextBox to appear
3. Added JavaScript for the Long free Text to hide this question but display only the textbox after Sub question 2 (Refer js code below)
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var htmml = $("<div />").append($("#answer{SID}X{GID}X{QID}")).html();
$('#subQn2describe').after(htmml);
$('#question{QID}').hide();
});
</script>
This works just perfect (with text typed in textbox stored in backend).
But does not work when a RELEVANCE EQUATION is assigned to the questions (need RelEquation on both questions)
The custom js code is executed when survey is loaded, but is overwritten when Relevance Equation is executed.
My Survey structure: (display group by group)
Group 1:
Qn1: Name; Qn2: Gender; Qn3: Date of Birth
Group 2: (display group 3 only if age is less than 18yrs)
Qn1: Array question ->
Relevance equation: (floor((time() - strtotime(Qn3)) / (60 * 60 * 24 * 365)) < 18)
Qn2: If Option 2, please describe -LongFreeText ->
Relevance equation: (floor((time() - strtotime(Qn3)) / (60 * 60 * 24 * 365)) < 18) ( .hide() in js code)
Any suggestion on how to achieve this with Relevance Equation?
Note: with relevance eqn, my js code is overwritten and questions appear in the default way. i.e., Array Qn1 and Textarea Qn2 as separate questions.
Thanks in advance.