Skip to content

Commit

Permalink
[#2351] Fix count of mandatory fields in section 8
Browse files Browse the repository at this point in the history
In section 8 there are two linked fields for the sector vocabulary and sector code. The bug where you can never fully complete section 8 is because two of the three sector code fields are always hidden, but are counted among the mandatory fields.

Fix by adding a check in markMandatoryFields() to exclude fields that have a parent with the always-hidden class.
  • Loading branch information
zzgvh committed Sep 8, 2016
1 parent 658eb63 commit 5dd2407
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions akvo/rsr/static/scripts-src/project-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,7 @@ function markMandatoryFields() {
var elementsToMark = document.querySelectorAll(mandatoryIndicator);
for (var k = 0; k < elementsToMark.length; k++) {
if (!elementsToMark[k].hasAttribute("disabled") &&
!findAncestorByClass(elementsToMark[k], 'always-hidden') &&
(!hasParent(elementsToMark[k]) ||
partialFilled(findAncestorByClass(elementsToMark[k], 'parent')) ||
(hasParent(elementsToMark[k]) &&
Expand Down
1 change: 1 addition & 0 deletions akvo/rsr/static/scripts-src/project-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2240,6 +2240,7 @@ function markMandatoryFields() {
var elementsToMark = document.querySelectorAll(mandatoryIndicator);
for (var k = 0; k < elementsToMark.length; k++) {
if (!elementsToMark[k].hasAttribute("disabled") &&
!findAncestorByClass(elementsToMark[k], 'always-hidden') &&
(!hasParent(elementsToMark[k]) ||
partialFilled(findAncestorByClass(elementsToMark[k], 'parent')) ||
(hasParent(elementsToMark[k]) &&
Expand Down
2 changes: 1 addition & 1 deletion akvo/templates/myrsr/project_editor/section_8.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ <h5>{% trans 'Humanitarian scope' %}</h5>
</form>
</div>
</div>
</div>
</div>

0 comments on commit 5dd2407

Please sign in to comment.