Skip to content

Commit 8a6fb64

Browse files
committed
Merge pull request victorjonsson#332 from Igloczek/required-fields-messages
Required fields messages
2 parents 98c14c9 + 24234bd commit 8a6fb64

File tree

11 files changed

+36
-7
lines changed

11 files changed

+36
-7
lines changed

form-validator/jquery.form-validator.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,12 @@
10271027
if (!validationErrorMsg) {
10281028
validationErrorMsg = $elem.attr(conf.validationErrorMsgAttribute);
10291029
if (!validationErrorMsg) {
1030-
validationErrorMsg = language[validator.errorMessageKey];
1030+
if (typeof validator.errorMessageKey !== 'function') {
1031+
validationErrorMsg = language[validator.errorMessageKey];
1032+
}
1033+
else {
1034+
validationErrorMsg = language[validator.errorMessageKey(conf)];
1035+
}
10311036
if (!validationErrorMsg) {
10321037
validationErrorMsg = validator.errorMessage;
10331038
}
@@ -1449,6 +1454,7 @@
14491454
*/
14501455
LANG: {
14511456
errorTitle: 'Form submission failed!',
1457+
requiredField: 'This is a required field',
14521458
requiredFields: 'You have not answered all required fields',
14531459
badTime: 'You have not given a correct time',
14541460
badEmail: 'You have not given a correct e-mail address',
@@ -1565,7 +1571,14 @@
15651571
}
15661572
},
15671573
errorMessage: '',
1568-
errorMessageKey: 'requiredFields'
1574+
errorMessageKey: function(config) {
1575+
if (config.errorMessagePosition === 'top' || config.errorMessagePosition === 'custom') {
1576+
return 'requiredFields';
1577+
}
1578+
else {
1579+
return 'requiredField';
1580+
}
1581+
}
15691582
});
15701583

15711584
/*

form-validator/lang/cz.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Podání formuláře selhalo!',
19+
requiredField: 'Toto pole je povinné',
1920
requiredfields: 'Nebyly vyplněny všechny požadované pole',
2021
badTime: 'Neplatný čas',
2122
badEmail: 'Neplatná e-mailová adresa',

form-validator/lang/de.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Ihre Anfrage konnte nicht gesendet werden!',
19+
requiredField: 'Dies ist ein Pflichtfeld',
1920
requiredFields: 'Sie haben nicht alle Fragen beantwortet',
2021
badTime: 'Sie haben nicht die korrekte Zeit eingegeben',
2122
badEmail: 'Sie haben keine gültige E-Mail-Adresse eingegeben',

form-validator/lang/es.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'El formulario no se ha podido enviar!',
19+
requiredField: 'Este campo es obligatorio',
1920
requiredFields: 'No ha contestado todos los campos requeridos',
2021
badTime: 'La hora proporcionada no es válida',
2122
badEmail: 'La dirección de e-mail no es válida',

form-validator/lang/fr.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Le formulaire n\'a pas pu être envoyé!',
19+
requiredField: 'Ce champ est obligatoire',
1920
requiredFields: 'Vous n\'avez pas rempli tous les champs',
2021
badTime: 'Vous n\'avez pas saisi l\'heure correctement',
2122
badEmail: 'Vous n\'avez pas saisi une adresse e-mail valide',

form-validator/lang/pl.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Złożenie formularza nie powiodło się!',
19+
requiredField: 'To pole jest wymagane',
1920
requiredfields: 'Nie wszystkie wymagane pola zostały wypełnione',
2021
badTime: 'Wprowadzono niepoprawny czas',
2122
badEmail: 'Wprowadzono niepoprawny adres e-mail',

form-validator/lang/pt.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'O formulário não pode ser enviado!',
19+
requiredField: 'Campo de preenchimento obrigatório',
1920
requiredFields: 'Você ainda não preencheu todos os campos obrigatórios',
2021
badTime: 'A hora digitada não é válida',
2122
badEmail: 'O e-mail digitado não é válido',

form-validator/lang/ro.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Nu sa reusit lansarea formularului!',
19+
requiredField: 'Acest câmp este obligatoriu',
1920
requiredfields: 'Nu toate câmpurile obligatorii au fost completate',
2021
badTime: 'Timpul introdus este incorect',
2122
badEmail: 'Adresa de e-mail este incorectă',

form-validator/lang/ru.dev.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
$(window).bind('validatorsLoaded', function() {
1616

1717
$.formUtils.LANG = {
18-
18+
1919
errorTitle: 'Ошибка отправки формы!',
20+
requiredField: 'Это обязательное поле',
2021
requiredFields: 'Вы задали не все обязательные поля',
2122
badTime: 'Вы задали некорректное время',
2223
badEmail: 'Вы задали некорректный e-mail',

form-validator/lang/sv.dev.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$.formUtils.LANG = {
1818
errorTitle: 'Formuläret kunde inte skickas!',
19+
requiredField: 'Detta är ett obligtoriskt fält',
1920
requiredFields: 'Du har inte besvarat alla frågor',
2021
badTime: 'Du har inte angett en korrekt tidpunkt',
2122
badEmail: 'Du har inte angett en korrekt e-postadress',

0 commit comments

Comments
 (0)