diff --git a/components/dataentry/inner-form.html b/components/dataentry/inner-form.html
index f59470c7c..8282f0d37 100644
--- a/components/dataentry/inner-form.html
+++ b/components/dataentry/inner-form.html
@@ -11,7 +11,8 @@
d2-option-filter="optionVisibility[currentEvent.event]"
d2-all-options="optionSets[prStDe.dataElement.optionSet.id].options"
d2-use-notification="true"
- d2-element="currentElement">
+ d2-element="currentElement"
+ d2-render-horizontally="prStDe.renderRadioHorizontally">
diff --git a/components/dataentry/section-inner-form.html b/components/dataentry/section-inner-form.html
index 634024fcc..c17271666 100644
--- a/components/dataentry/section-inner-form.html
+++ b/components/dataentry/section-inner-form.html
@@ -24,7 +24,8 @@
d2-options="optionSets[prStDes[de.id].dataElement.optionSet.id].options"
d2-required="prStDes[de.id].compulsory || mandatoryFields[currentEvent.event][de.id]"
d2-disabled="!dataElementEditable(prStDes[de.id])"
- d2-function="saveDataValueForRadio(prStDes[de.id], currentEvent, value)">
+ d2-function="saveDataValueForRadio(prStDes[de.id], currentEvent, value)"
+ d2-render-horizontally="prStDes[de.id]">
diff --git a/components/home/search/search.html b/components/home/search/search.html
index 5568cdfad..b1cd006d6 100644
--- a/components/home/search/search.html
+++ b/components/home/search/search.html
@@ -48,7 +48,7 @@ {{'search_for'| translate}}
d2-name="foo"
d2-object="searchGroup"
d2-options="base.optionSets[attribute.optionSet.id].options"
- >
+ d2-render-horizontally="attribute.renderRadioHorizontally">
diff --git a/components/registration/default-registration-form.html b/components/registration/default-registration-form.html
index 98ba9654e..3030c560b 100644
--- a/components/registration/default-registration-form.html
+++ b/components/registration/default-registration-form.html
@@ -64,7 +64,8 @@
d2-option-filter="optionVisibility"
d2-options="optionSets[attributesById[attribute.id].optionSet.id].options"
d2-required="attributeIsRequired(attribute.id, attribute.mandatory)"
- d2-disabled="attributeFieldDisabled(attribute)">
+ d2-disabled="attributeFieldDisabled(attribute)"
+ d2-render-horizontally="attribute.renderRadioHorizontally">
diff --git a/core/tracker-capture.js b/core/tracker-capture.js
index 1e92b798b..5aec65664 100644
--- a/core/tracker-capture.js
+++ b/core/tracker-capture.js
@@ -364,6 +364,21 @@ function getBatchPrograms( programs, batch )
if( program.programStages ){
program.programStages = _.sortBy( program.programStages, 'sortOrder' );
+ _.each( program.programStages, function ( prSt ) {
+ if ( prSt.programStageDataElements ) {
+ _.each( prSt.programStageDataElements, function ( prStDe ) {
+ if ( prStDe.renderType && prStDe.renderType.DESKTOP ) {
+ const renderType = prStDe.renderType.DESKTOP.type;
+ if (renderType === 'VERTICAL_RADIOBUTTONS' || renderType === 'HORIZONTAL_RADIOBUTTONS') {
+ prStDe.renderOptionsAsRadio = true;
+ prStDe.renderRadioHorizontally = renderType === 'HORIZONTAL_RADIOBUTTONS';
+ }
+ } else if ( prStDe.renderOptionsAsRadio ) {
+ prStDe.renderRadioHorizontally = false;
+ }
+ });
+ }
+ });
}
if( program.categoryCombo && program.categoryCombo.categories ){
diff --git a/d2-tracker/dhis2.angular.directives.js b/d2-tracker/dhis2.angular.directives.js
index 46f8aa75b..c97923de3 100644
--- a/d2-tracker/dhis2.angular.directives.js
+++ b/d2-tracker/dhis2.angular.directives.js
@@ -1016,7 +1016,8 @@ var d2Directives = angular.module('d2Directives', [])
d2Required: '=',
d2Options: '=',
d2CallbackFunction: '&d2Function',
- d2OptionFilter: '='
+ d2OptionFilter: '=',
+ d2RenderHorizontally: '='
},
link: function (scope, element, attrs) {
diff --git a/d2-tracker/templates/radio-input.html b/d2-tracker/templates/radio-input.html
index 4eab71322..fef56c9c8 100644
--- a/d2-tracker/templates/radio-input.html
+++ b/d2-tracker/templates/radio-input.html
@@ -1,21 +1,22 @@
-
-
-
- {{option.displayName}}
-
+
+
+
+
+ {{option.displayName}}
+
-
-
-
-
\ No newline at end of file
+
+
+
+
diff --git a/scripts/services.js b/scripts/services.js
index 58456583c..ed6e32fcd 100644
--- a/scripts/services.js
+++ b/scripts/services.js
@@ -1418,9 +1418,18 @@ var trackerCaptureServices = angular.module('trackerCaptureServices', ['ngResour
att.mandatory = pAttribute.mandatory;
att.displayInListNoProgram = pAttribute.displayInList;
- if(pAttribute.renderOptionsAsRadio){
- att.renderOptionsAsRadio = pAttribute.renderOptionsAsRadio;
+ att.renderOptionsAsRadio = false;
+ if (pAttribute.renderType && pAttribute.renderType.DESKTOP) {
+ const renderType = pAttribute.renderType.DESKTOP.type;
+ if (renderType === 'VERTICAL_RADIOBUTTONS' || renderType === 'HORIZONTAL_RADIOBUTTONS') {
+ att.renderOptionsAsRadio = true;
+ att.renderRadioHorizontally = renderType === 'HORIZONTAL_RADIOBUTTONS';
+ }
+ } else if (pAttribute.renderOptionsAsRadio) {
+ att.renderOptionsAsRadio = true;
+ att.renderRadioHorizontally = false;
}
+
if(pAttribute.searchable)
{
att.searchable = pAttribute.searchable;