Fill submission text if the field is currently empty
This commit is contained in:
parent
e4fea7188b
commit
1f9da86e39
1 changed files with 12 additions and 3 deletions
|
|
@ -147,6 +147,15 @@ function word_count(text, divId, maxcount) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function fill_if_empty(text_area, filler) {
|
||||||
|
let area = $('#' + text_area);
|
||||||
|
|
||||||
|
if (!area.val()) {
|
||||||
|
area.val(filler);
|
||||||
|
area.trigger('change');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait for the DOM to be ready before attaching events to the elements */
|
/* Wait for the DOM to be ready before attaching events to the elements */
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
/* Set the minimum and maximum proposal abstract and submission text word length */
|
/* Set the minimum and maximum proposal abstract and submission text word length */
|
||||||
|
|
@ -155,15 +164,15 @@ $( document ).ready(function() {
|
||||||
var max = $selected.data("max-words");
|
var max = $selected.data("max-words");
|
||||||
var min = $selected.data("min-words");
|
var min = $selected.data("min-words");
|
||||||
|
|
||||||
|
// Set the placeholder text for the abstract
|
||||||
|
fill_if_empty('event_submission_text', $selected.data("help"));
|
||||||
|
|
||||||
$("#abstract-maximum-word-count").text(max);
|
$("#abstract-maximum-word-count").text(max);
|
||||||
$("#submission-maximum-word-count").text(max);
|
$("#submission-maximum-word-count").text(max);
|
||||||
$("#abstract-minimum-word-count").text(min);
|
$("#abstract-minimum-word-count").text(min);
|
||||||
$("#submission-minimum-word-count").text(min);
|
$("#submission-minimum-word-count").text(min);
|
||||||
word_count($('#event_abstract').get(0), 'abstract-count', max);
|
word_count($('#event_abstract').get(0), 'abstract-count', max);
|
||||||
word_count($('#event_submission_text').get(0), 'submission-count', max);
|
word_count($('#event_submission_text').get(0), 'submission-count', max);
|
||||||
|
|
||||||
// Set the placeholder text for the abstract
|
|
||||||
$('#event_submission_text').attr("placeholder", $selected.data("help"));
|
|
||||||
})
|
})
|
||||||
.trigger('change');
|
.trigger('change');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue