Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/TemplateAll.adc
Binary file not shown.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ Version
v4.2.14 - Datetime fixed
v4.2.15 - JQuery removed.
v4.2.16 - Fixed exclusives.
v4.2.17 - included askiascript variables for min/max date
v4.2.18 - fixed onclock event listener firing multiple times per askia-response element on the screen
19 changes: 18 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<info>
<name>TemplateAll</name>
<guid>feba6dd4-1a09-4470-a854-e89c59821d8e</guid>
<version>4.2.16</version>
<version>4.2.18</version>
<date>2023-12-19</date>
<description><![CDATA[Default ADC with all kind of questions]]></description>
<company>Askia SAS</company>
Expand Down Expand Up @@ -285,7 +285,24 @@ Format: MM/DD/YYYY]]></description>
<description><![CDATA[The caption of the don't know button]]></description>
<value><![CDATA[Don't know]]></value>
</property>
<property xsi:type="standardProperty" id="useScript" name="Askiascript for Min/Max" type="string" mode="dynamic" require="false" visible="true">
<description><![CDATA[Use Askiascript to set the Min Max dates in the control.]]></description>
<value><![CDATA[0]]></value>
<options>
<option value="1" text="Yes" />
<option value="0" text="No" />
</options>
</property>
<property xsi:type="standardProperty" id="minScript" name="Min Date" type="string" mode="dynamic" require="false" visible="true">
<description><![CDATA[0]]></description>
<value></value>
</property>
<property xsi:type="standardProperty" id="maxScript" name="Max Date" type="string" mode="dynamic" require="false" visible="true">
<description><![CDATA[0]]></description>
<value></value>
</property>
</category>

<category id="timePicker" name="Time question">
<property xsi:type="standardProperty" id="imperial" name="Time format" type="string" mode="dynamic" require="true" visible="false">
<description><![CDATA[Option to choose 24 hour clock or 12 hour clock]]></description>
Expand Down
Binary file modified example/TemplateAll.qex
Binary file not shown.
6 changes: 6 additions & 0 deletions resources/dynamic/Initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ dim numberOfMonths
dim mainCalendar
dim minDate
dim maxDate
dim useScript
dim minBound
dim maxBound
dim minScript
dim maxScript
%}
(function () {
var adcdefault = new AdcDefault({
Expand Down Expand Up @@ -65,6 +68,7 @@ dim maxBound
showMonthAfterYear = CurrentADC.PropValue("showMonthAfterYear")
numberOfMonths = CurrentADC.PropValue("numberOfMonths")
mainCalendar = "'"+CurrentADC.PropValue("mainCalendar")+"'"
useScript = CurrentADC.PropValue("useScript").ToNumber()
minDate = column.MinDate.Format("yyyy-MM-dd")
maxDate = column.MaxDate.Format("yyyy-MM-dd")
minBound = column.MinDate.Format("yyyy").ToNumber()
Expand All @@ -77,6 +81,8 @@ dim maxBound
if CvDkNa(maxBound) < 1 Then
maxBound = 2100
EndIf



inputName = column.InputName()
inputId = (inputName + "_" + 1).Replace("D", "askia-input-dateO") %}
Expand Down
59 changes: 44 additions & 15 deletions resources/static/adc_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,23 +288,52 @@
return result;
}

/**
* Manually check the input(radio/checkbox) on response-label click.
*/
var askResponses = document.getElementsByClassName('askia-response');
for (var i = 0; i < askResponses.length; i++) {
var response = askResponses[i];
response.addEventListener('click', function(event) {
/**
* Manually check the input(radio/checkbox) on response-label click.
*
* This version is guarded so it only installs once, even if adc_default.js
* is initialized multiple times.
*/
if (!window.__askiaResponseClickHandlerInstalled) {
window.__askiaResponseClickHandlerInstalled = true;

document.addEventListener('click', function(event) {
var clickedElement = event.target || event.srcElement;
if (clickedElement.tagName !== "INPUT") {
var inputId = this.querySelector(".askia-response-label").dataset.for;
var inputElement = document.getElementById(inputId);
inputElement.click();
if (inputElement.type== "checkbox") {
event.preventDefault();
}

// Let real input clicks behave normally.
if (!clickedElement || clickedElement.tagName === "INPUT") {
return;
}
}, { capture: true });

// Find the response row that was clicked.
var response = clickedElement.closest
? clickedElement.closest('.askia-response')
: null;

if (!response) {
return;
}

var label = response.querySelector('.askia-response-label');

if (!label || !label.dataset || !label.dataset.for) {
return;
}

var inputElement = document.getElementById(label.dataset.for);

if (!inputElement || inputElement.disabled) {
return;
}

// Stop the original row/label click from also toggling the input.
event.preventDefault();
event.stopPropagation();

// Fire one intentional input click.
inputElement.click();

}, true);
}

/**
Expand Down
Loading