Skip to content

Commit

Permalink
orcid issue
Browse files Browse the repository at this point in the history
  • Loading branch information
neerajdarwin committed Jan 17, 2025
1 parent 7caeca0 commit b1efbf8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,15 @@
delCssSelector = $.trim(options.deleteCssClass).replace(/\s+/g, '.');
applyExtraClasses(row, formCount);
row.insertBefore(buttonRow).show();
options.added = function(row) {
// Apply the required class and add * to labels for all required fields
row.find('input.required_field, select.required_field, textarea.required_field').each(function() {
const $field = $(this);
const $label = $field.closest('.form-group').find('label');
if (!$label.hasClass('required')) {
$label.addClass('required').append(' <span>*</span>');
}
});
};
// options.added = function(row) {
// row.find('input.required_field, select.required_field, textarea.required_field').each(function() {
// const $field = $(this);
// const $label = $field.closest('.form-group').find('label');
// if (!$label.hasClass('required')) {
// $label.addClass('required').append(' <span>*</span>');
// }
// });
// };
row.find(childElementSelector).each(function() {
updateElementIndex($(this), options.prefix, formCount);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@
});
}

function requiredFields(row){
row.find('input.required_field, select.required_field, textarea.required_field').each(function() {
const $field = $(this);
const $label = $field.closest('.form-group').find('label');
if (!$label.hasClass('required')) {
$label.addClass('required').append(' <span>*</span>');
}
});
}

jQueryForFormset(function () {
jQueryForFormset('#{{ form_set.prefix }} tbody tr').formset({
prefix: '{{ form_set.prefix }}',
Expand All @@ -297,6 +307,7 @@
delete_allow_overbudget_field(row);
highlight_row_delete_link_hover(row);
enable_orcid_in_row(row);
requiredFields(row);
updateDeleteButtons();
},
removed: function (row) {
Expand Down

0 comments on commit b1efbf8

Please sign in to comment.