Browse Source

Bug fix so that question with free form answer is persisted correctly

pull/160/head
Benard Ebinu 8 years ago
parent
commit
6253f8ff54
3 changed files with 12 additions and 3 deletions
  1. +4
    -0
      edivorce/apps/core/static/js/main.js
  2. +6
    -1
      edivorce/apps/core/templates/partials/your_children_child.html
  3. +2
    -2
      edivorce/apps/core/templates/question/06_children.html

+ 4
- 0
edivorce/apps/core/static/js/main.js View File

@ -241,12 +241,16 @@ $(function () {
$(this).find('.child-field').each(function() {
var fieldName = $(this).attr('data-target-form-field');
var targetInput = $("input[name='" +fieldName + "']");
if (targetInput.length === 0) {
targetInput = $("textarea[name='" +fieldName + "']");
}
var mirrorTargetId = replaceSuffix(targetInput.attr('data-mirror_target'), activeChildRow);
targetInput.attr('data-mirror_target', mirrorTargetId);
if (targetInput.prop('type') === 'text' || targetInput.prop('type') === 'textarea') {
targetInput.val($(this).text());
targetInput.show();
} else if (targetInput.prop('type') === 'radio') {
targetInput.filter("[value='" + $(this).text() + "']").prop('checked', true);
}


+ 6
- 1
edivorce/apps/core/templates/partials/your_children_child.html View File

@ -35,4 +35,9 @@
<div id="child_custody_{{ div_id }}"
class="child-field"
data-target-form-field="child_custody">{{ custody }}</div>
</td>
</td>
<td class="list-builder-hide-column">
<div id="child_live_with_other_details_{{ div_id }}"
class="child-field"
data-target-form-field="child_live_with_other_details">{{ other_details }}</div>
</td>

+ 2
- 2
edivorce/apps/core/templates/question/06_children.html View File

@ -36,7 +36,7 @@
{% for child in children %}
<tr class="child-item-row" data-counter="{{ forloop.counter }}">
{{ child.name }}
{% include "partials/your_children_child.html" with name=child.child_name birth_date=child.child_birth_date live_with=child.child_live_with custody=child.child_custody live_with=child.child_live_with relationship_to_you=child.child_relationship_to_you relationship_to_spouse=child.child_relationship_to_spouse div_id=forloop.counter counter=forloop.counter %}
{% include "partials/your_children_child.html" with name=child.child_name birth_date=child.child_birth_date live_with=child.child_live_with custody=child.child_custody live_with=child.child_live_with relationship_to_you=child.child_relationship_to_you relationship_to_spouse=child.child_relationship_to_spouse other_details=child.child_live_with_other_details div_id=forloop.counter counter=forloop.counter %}
</tr>
{% endfor %}
{% endif %}
@ -102,7 +102,7 @@
<label>
{% input_field type="radio" class="radio-with-other radio-with-textbox children-input-block" name="child_live_with" value="Other" data_target_id="other_child_details" data_reveal_target="true" data_mirror="true" data_mirror_target="#child_live_with_0" data_skip_ajax="true" %}
Other
{% input_field type="textarea" class="response-textbox other-textbox input-inline children-input-block" name="child_live_with_other_details" id="other_child_details" maxlength="500" rows="3" tabindex="-1" hidden="" data_skip_ajax="true" %}
{% input_field type="textarea" class="response-textbox other-textbox input-inline children-input-block" name="child_live_with_other_details" id="other_child_details" maxlength="500" rows="3" tabindex="-1" hidden="" data_mirror="true" data_mirror_target="#child_live_with_other_details_0" data_skip_ajax="true" %}
</label>
</div>


Loading…
Cancel
Save