Browse Source

Merged with feature branch for DIV-490

pull/160/head
Charles Shin 8 years ago
parent
commit
154036966a
2 changed files with 17 additions and 5 deletions
  1. +16
    -5
      edivorce/apps/core/static/js/main.js
  2. +1
    -0
      edivorce/apps/core/templates/question/02_claimant.html

+ 16
- 5
edivorce/apps/core/static/js/main.js View File

@ -61,16 +61,26 @@ $(function () {
}
// Add name button adds new input field for adding other name
// Maximum of two other name fields allowed
// Maximum of two other name fields allowed
$("#btn_add_other_names").on('click', function () {
if ($('#other_names_fields input[type=text]').length < 2) {
$('#other_names_fields').append($('#other_names_group').children().clone(true));
}
else {
$('#btn_add_other_names').prop("disabled",true).prop("value","Max 2 other names");
}
showWarningOtherName();
});
// Show warning text when there are 2 other name fields
var showWarningOtherName = function() {
if ($('#other_names_fields input[type=text]').length >= 2) {
$('#btn_add_other_names').hide();
$('#other_name_warning_message').html("<p>Max 2 other names, please enter only the name variations to be shown on the order from the court</p>");
}
};
// show warning message if other name field is already at its maximum number when the page rendered
showWarningOtherName();
$("#btn_add_reconciliation_periods").on('click', function () {
$('#reconciliation_period_fields').append($('#reconciliation_period_group').children().clone());
// add event lister for newly added from_date field, to_date field, delete button, and date picker
@ -164,7 +174,8 @@ var deleteAddedField = function(e){
//enable btn_add_other_names button
if (button.prop('id') == "btn_add_other_names"){
button.prop('disabled',false).prop('value','Add name');
button.show();
$('#other_name_warning_message').html("");
}
// when there is only one field left, clear it instead of delete it


+ 1
- 0
edivorce/apps/core/templates/question/02_claimant.html View File

@ -85,6 +85,7 @@
{% endif %}
</div>
<input type="button" id="btn_add_other_names" class="btn btn-success" value="Add name" data-add-for="you" />
<div id="other_name_warning_message"></div>
</div>
</div>


Loading…
Cancel
Save