Zarejestrowałaś/zarejestrowałeś się w sklepie?
Aktywuj swoje konto użytkownika, wpisując swoje dane logowania oraz numer uczestnika programu. Następnie wprowadź wybrane przez siebie hasło.
Wybierz poniżej rodzaj swojego członkostwa:
$(this).closest('#pl-registerWithScsOfflineMemberFormConfigWrapper').find('.js-pl-registerWithScsOfflineMemberFormConfig')
.formValidation(
{
autoFocus: false,
framework: 'bootstrap',
icon: {
valid: null,
invalid: null,
validating: null
},
fields: {
'values[registerWithScsOfflineMemberFormDefinition_membershipNumber]': {
trigger: 'blur',
validators: {
callback: {
callback: function(value, validator, $field) {
var messages = [];
var messagesEN = [];
var errorOccured = false;
if ($field.attr('regexCheckDisabled') === 'true') {
return true;
}
if (!value.trim().match(new RegExp('^(\\d{3}(-*)\\d+)?$', ''))) {
messages.push('Wprowadź prawidłowy numer członka programu w formacie 123-45455');
messagesEN.push('Wprowadź prawidłowy numer członka programu w formacie 123-45455');
errorOccured |= true;
}
if (errorOccured) {
return {
valid: false,
message: messages.join('<br/>'),
message_en: messagesEN
}
} else {
return true;
}
}
},
notEmpty: {
message: 'Pole „Numer członka programu” nie może być puste',
message_en: 'Pole „Numer członka programu” nie może być puste'
},
stringLength: {
message: 'Liczba znaków w tym polu musi wynosić od0 do 11',
message_en: 'The number of characters for this field must be between 0 and 11',
min: 0
,
max: 11
},
}
},
'values[registerWithScsOfflineMemberFormDefinition_email]': {
trigger: 'blur',
validators: {
regexp: {
regexp: new RegExp('^(?=.{0,255}$)(?=.{0,64}@)(?:(?!^\\.)(?!.*\\.@)(?!.*\\.\\.)[a-zA-Z0-9!#.$%&\'*+\/=?^_‘{|}~-]+|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]){1,62}\")@(?!-)(?!.*\\.-)(?!.*-\\.)(?:[a-zA-Z0-9-]{1,61}\\.){1,126}(?=[a-zA-Z0-9-]*[a-zA-Z][a-zA-Z0-9-]*$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$', ''),
message: 'Podaj swój adres e-mail.',
message_en: 'Podaj swój adres e-mail.'
},
notEmpty: {
message: 'Podaj swój adres e-mail.',
message_en: 'Podaj swój adres e-mail.'
},
stringLength: {
message: 'Liczba znaków w tym polu musi wynosić od1 do 70',
message_en: 'The number of characters for this field must be between 1 and 70',
min: 1
,
max: 70
},
}
},
'values[registerWithScsOfflineMemberFormDefinition_password]': {
trigger: 'blur',
validators: {
callback: {
callback: function(value, validator, $field) {
var messages = [];
var messagesEN = [];
var errorOccured = false;
if ($field.attr('regexCheckDisabled') === 'true') {
return true;
}
if (!value.match(new RegExp('(^$|^(?=.*[0-9])(?=.*[A-Z]).{7,}$)', ''))) {
messages.push('Hasło musi mieć co najmniej 7 znaków, a także zawierać jedną cyfrę i jedną wielką literę.');
messagesEN.push('Hasło musi mieć co najmniej 7 znaków, a także zawierać jedną cyfrę i jedną wielką literę.');
errorOccured |= true;
}
if (errorOccured) {
return {
valid: false,
message: messages.join('<br/>'),
message_en: messagesEN
}
} else {
return true;
}
}
},
notEmpty: {
message: 'Prosimy o ustalenie hasła.',
message_en: 'Prosimy o ustalenie hasła.'
},
stringLength: {
message: 'Maksymalna długość 64 znaków dla tego pola została przekroczona',
message_en: 'You have exceeded the maximum length of 64 characters for this field',
max: 64
},
}
},
'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]': {
err: "#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince-date-error-messages",
excluded: false,
trigger: 'blur',
validators: {
callback: {
message: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidDay, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidDay\u003C\/span\u003E',
message_en: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidDay, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidDay\u003C\/span\u003E',
callback: function(value, validator, $field) {
var input = $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day');
if($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').val() && value && $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').val()){
var currentDate = new Date().getTime();
var fieldsDDMMYYYY = value ? new Date($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').val() + "." + value + "." + $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').val()).getTime() : new Date().getTime() + 1;
if(typeof fieldsDDMMYYYY == "number" && ((fieldsDDMMYYYY > currentDate)||(fieldsDDMMYYYY < currentDate))) {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]');
}
}
if (ACC.global.isDateFieldEmpty("registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince")) {
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month');
}
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]');
}
input.addClass('date-input-no-confirmation');
return true;
} else {
input.removeClass('date-input-no-confirmation');
}
if ($field.val().match("^\\d+$") == null) {
return false;
}
var value = parseInt($field.val());
var monthValue = $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').val();
var yearValue = $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').val();
if (monthValue == "" && yearValue == "") {
return value >= 1 && value <= 31;
}
if (monthValue == "2" && yearValue == "") {
return value >= 1 && value <= 29;
}
var month = parseInt(monthValue);
var year = parseInt(yearValue);
return value >= 1 && value <= ACC.global.numberOfDaysInMonth(month, year);
}
}
}
},
'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]': {
err: "#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince-date-error-messages",
excluded: false,
trigger: 'blur',
validators: {
callback: {
message: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidMonth, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidMonth\u003C\/span\u003E',
message_en: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidMonth, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidMonth\u003C\/span\u003E',
callback: function(value, validator, $field) {
if(value && $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val() && $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').val()){
var currentDate = new Date().getTime();
var fieldsDDMMYYYY = new Date(value + "." + $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val() + "." + $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').val()).getTime();
if(typeof fieldsDDMMYYYY == "number" && ((fieldsDDMMYYYY > currentDate)||(fieldsDDMMYYYY < currentDate))) {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]');
}
}
if (ACC.global.isDateFieldEmpty("registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince")) {
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
}
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]');
}
$('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').addClass('date-input-no-confirmation');
return true;
} else {
$('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').removeClass('date-input-no-confirmation');
}
if ($field.val().match("^\\d+$") == null){
return false;
}
var value = parseInt($field.val());
if ($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val() != "") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
}
return value >= 1 && value <= 12;
}
}
}
},
'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]': {
err: "#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince-date-error-messages",
excluded: false,
trigger: 'blur',
validators: {
callback: {
message: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidYear, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidYear\u003C\/span\u003E',
message_en: '\u003Cspan style=\'color:#ff0000;\'\u003Eerror.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidYear, error.genericConfigurableForm.loyaltyMembershipCardValidSince.noValidYear\u003C\/span\u003E',
callback: function(value, validator, $field) {
var value = $field.val();
var currentDate = new Date().getTime();
var fieldsDDMMYYYY = value ? new Date($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').val() + "." + $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val() + "." + value).getTime() : new Date().getTime()+1;
if (ACC.global.isDateFieldEmpty("registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince")) {
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
}
if ($("small[data-fv-for='" + 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]' +"']").attr('data-fv-result') == "INVALID") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]');
}
$('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').addClass('date-input-no-confirmation');
return true;
} else {
$('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').removeClass('date-input-no-confirmation');
}
if($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').val() && value && $('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val()){
if(typeof fieldsDDMMYYYY == "number" && (fieldsDDMMYYYY > currentDate)) {
return false;
} else if (typeof fieldsDDMMYYYY == "number" && (fieldsDDMMYYYY < currentDate)) {
return true;
}
}
if (!ACC.global.isValidYear("registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince")) {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]');
$('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').removeClass('date-input-no-confirmation');
return false;
}
if (value.match("^\\d{4}$") != null) {
if ($('#registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').val() != "") {
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
}
return true;
}
return false;
}
}
}
},
'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince]': {
trigger: 'blur',
validators: {
/**
* Validating date field with custom format when given only month/year using the callback validator and momentjs to parse/validate,
* since OOTB (form validation framework) attribute "format" of the object "date" does not support custom format validation like month/year.
* More info: https://old.formvalidation.io/validators/date/#custom-format-example
*/
callback: {
message: 'Podaj prawidłową datę.',
message_en: 'Podaj prawidłową datę.',
callback: function (value, validator) {
var dateFormat = 'MM.YYYY';
if (!dateFormat) {
return false;
}
var dateObjectCurrent = moment(value, dateFormat);
var minDate = moment('12.1974', dateFormat)
if (dateObjectCurrent.isBefore(minDate)) {
return false;
}
var maxDate = moment('12.2024', dateFormat)
if (dateObjectCurrent.isAfter(maxDate)) {
return false;
}
var strictMode = true; // indicates that strict mode should be applied to parse the date string
return moment(value, dateFormat, strictMode).isValid();
}
},
callbackDate: {
alias: 'callback',
callback: function(value, validator, $field) {
/** The day/month/year fields are hidden in the UI and are populated in JS, by splitting the date field.
The change in the fields is not detected in the validation framework and it requires to manually call
the revalidation after each change of the date field. Otherwise, the fields will remain in an invalid state
and the form validation will fail (preventing the form submission).
*/
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day]');
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month]');
$('.js-pl-registerWithScsOfflineMemberFormConfig').formValidation('revalidateField', 'values[registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year]');
return true;
}
},
}
}
}
}
)
.on('success.field.fv', function() {
/* note: we need to check if there is an error in the form, as the plugin does a validation on field level.
Validating the whole form on blur of a field is no option, as the customer does not want to see error messages on all fields
when entering one field. In case of an error on at least one field we disable the submit button manually */
var $form = $(this).closest('form');
if ($form.find('.form-group.has-error').length > 0) {
var $button = $form.find('.js-button');
if (!$button.hasClass('disabled')) {
$button.addClass('disabled');
}
}
})
.on('err.field.fv', function(e, data) {
/*
* On error field validation, enable submit button.
* Source: https://old.formvalidation.io/examples/enabling-submit-button/
*/
data.fv.disableSubmitButtons(false);
if(data.element.closest('.form-combo-molecule').length){
/* Get the messages of field */
var messages = data.fv.getMessages(data.element);
/* Get the error message content of the field */
var errorContent = data.element.closest('.form-combo-molecule').find('.errors');
/* Get the hidden error message of the field */
var errorField = errorContent.find('.swa-form-input__error-message[data-field="' + data.field + '"][style="display: none;"]');
/* Loop over the messages */
for (var i in messages) {
if (errorField[1] == undefined) {
var newErrorContainer = document.createElement("small");
$(newErrorContainer).attr("class", "swa-form-input__error-message swa-headline-sans--supertiny");
$(newErrorContainer).attr("data-field", data.field);
$(newErrorContainer).attr("data-fv-validator", "callback");
$(newErrorContainer).attr("data-fv-for", $(data.element[0]).attr("name") );
$(newErrorContainer).attr("data-fv-result", "INVALID");
$(newErrorContainer).attr("data-tracked", "true");
$(newErrorContainer).html(messages[i]);
if (errorContent.text().includes(messages[i])) {
$(newErrorContainer).hide();
}
errorContent.append(newErrorContainer);
}
}
}
})
.on('success.field.fv', function(e, data) {
/*
* On success field validation, enable submit button.
* Source: https://old.formvalidation.io/examples/enabling-submit-button/
*/
data.fv.disableSubmitButtons(false);
/* Remove the field messages */
$errorContent = data.element.closest('.form-combo-molecule').find('.errors');
$errorContent.find('.swa-form-input__error-message[data-field="' + data.field + '"]').remove();
$errorContent.find('.swa-form-input__error-message[data-fv-result="INVALID"]').removeAttr("style");
})
.on('success.form.fv', function() {
var formId = 'registerWithScsOfflineMember';
if (!formId || formId === 'cfRequest' || formId === 'cfResponse') {
formId = 'registerWithScsOfflineMemberFormDefinition';
}
ACC.tracking.pushFormSubmit(formId);
});
var replaceDatePatternWithValue = function(mandatory, fieldConfigCode, fieldConfigPattern) {
var date = fieldConfigPattern.toUpperCase();
var year = $("#" + fieldConfigCode + "_year").val();
var month = $("#" + fieldConfigCode + "_month").val();
var day = $("#" + fieldConfigCode + "_day").val();
date = date.replace(/[Y]+/, year);
date = date.replace(/[M]+/, month);
date = date.replace(/[D]+/, day);
var hiddenDateField = $('.js-' + fieldConfigCode + '_hidden');
if (mandatory) {
hiddenDateField.val(date);
} else {
hiddenDateField.val(date == "" ? "" : date);
}
};
var triggerFormValidation = function(fieldId, mandatory, fieldCode, dateFormat) {
replaceDatePatternWithValue(mandatory, fieldCode, dateFormat);
$('.js-fieldCode').formValidation('revalidateField', 'values[fieldCode_'+ fieldId + ']');
};
var removeDateMoleculeError = function(molecule) {
if(molecule.hasClass('has-error')){
molecule.removeClass('has-error');
molecule.find('.help-block').find('span').remove();
}
};
$('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_day').blur(function() {
removeDateMoleculeError($('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince').closest('.form-combo-molecule'));
triggerFormValidation("day", false, "registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince", "MM.yyyy");
});
$('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_month').blur(function() {
removeDateMoleculeError($('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince').closest('.form-combo-molecule'));
triggerFormValidation("month", false, "registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince", "MM.yyyy");
});
$('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince_year').blur(function() {
removeDateMoleculeError($('.js-registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince').closest('.form-combo-molecule'));
triggerFormValidation("year", false, "registerWithScsOfflineMemberFormDefinition_loyaltyMembershipCardValidSince", "MM.yyyy");
});
$(this).closest('#scRegisterWithMembershipNumberFormDefinitionWrapper').find('.js-scRegisterWithMembershipNumberFormDefinition')
.formValidation(
{
autoFocus: false,
framework: 'bootstrap',
icon: {
valid: null,
invalid: null,
validating: null
},
fields: {
'values[scRegisterWithMembershipNumberFormDefinition_membershipNumber]': {
trigger: 'blur',
validators: {
callback: {
callback: function(value, validator, $field) {
var messages = [];
var messagesEN = [];
var errorOccured = false;
if ($field.attr('regexCheckDisabled') === 'true') {
return true;
}
if (!value.trim().match(new RegExp('^[0-9]*$', ''))) {
messages.push('Wprowadź wartość liczbową');
messagesEN.push('Wprowadź wartość liczbową');
errorOccured |= true;
}
if (errorOccured) {
return {
valid: false,
message: messages.join('<br/>'),
message_en: messagesEN
}
} else {
return true;
}
}
},
notEmpty: {
message: 'Wpisz nr członkowski.',
message_en: 'Wpisz nr członkowski.'
},
stringLength: {
message: 'Liczba znaków w tym polu musi wynosić od0 do 11',
message_en: 'The number of characters for this field must be between 0 and 11',
min: 0
,
max: 11
},
}
},
'values[scRegisterWithMembershipNumberFormDefinition_email]': {
trigger: 'blur',
validators: {
regexp: {
regexp: new RegExp('^(?=.{0,255}$)(?=.{0,64}@)(?:(?!^\\.)(?!.*\\.@)(?!.*\\.\\.)[a-zA-Z0-9!#.$%&\'*+\/=?^_‘{|}~-]+|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f]){1,62}\")@(?!-)(?!.*\\.-)(?!.*-\\.)(?:[a-zA-Z0-9-]{1,61}\\.){1,126}(?=[a-zA-Z0-9-]*[a-zA-Z][a-zA-Z0-9-]*$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$', ''),
message: 'Podaj swój adres e-mail.',
message_en: 'Podaj swój adres e-mail.'
},
notEmpty: {
message: 'Podaj swój adres e-mail.',
message_en: 'Podaj swój adres e-mail.'
},
}
},
'values[scRegisterWithMembershipNumberFormDefinition_password]': {
trigger: 'blur',
validators: {
callback: {
callback: function(value, validator, $field) {
var messages = [];
var messagesEN = [];
var errorOccured = false;
if ($field.attr('regexCheckDisabled') === 'true') {
return true;
}
if (!value.match(new RegExp('(^$|^(?=.*[0-9])(?=.*[A-Z]).{7,}$)', ''))) {
messages.push('Hasło musi mieć co najmniej 7 znaków, a także zawierać jedną cyfrę i jedną wielką literę.');
messagesEN.push('Hasło musi mieć co najmniej 7 znaków, a także zawierać jedną cyfrę i jedną wielką literę.');
errorOccured |= true;
}
if (errorOccured) {
return {
valid: false,
message: messages.join('<br/>'),
message_en: messagesEN
}
} else {
return true;
}
}
},
notEmpty: {
message: 'Podaj hasło.',
message_en: 'Podaj hasło.'
},
stringLength: {
message: 'Maksymalna długość 64 znaków dla tego pola została przekroczona',
message_en: 'You have exceeded the maximum length of 64 characters for this field',
max: 64
},
}
}
}
}
)
.on('success.field.fv', function() {
/* note: we need to check if there is an error in the form, as the plugin does a validation on field level.
Validating the whole form on blur of a field is no option, as the customer does not want to see error messages on all fields
when entering one field. In case of an error on at least one field we disable the submit button manually */
var $form = $(this).closest('form');
if ($form.find('.form-group.has-error').length > 0) {
var $button = $form.find('.js-button');
if (!$button.hasClass('disabled')) {
$button.addClass('disabled');
}
}
})
.on('err.field.fv', function(e, data) {
/*
* On error field validation, enable submit button.
* Source: https://old.formvalidation.io/examples/enabling-submit-button/
*/
data.fv.disableSubmitButtons(false);
if(data.element.closest('.form-combo-molecule').length){
/* Get the messages of field */
var messages = data.fv.getMessages(data.element);
/* Get the error message content of the field */
var errorContent = data.element.closest('.form-combo-molecule').find('.errors');
/* Get the hidden error message of the field */
var errorField = errorContent.find('.swa-form-input__error-message[data-field="' + data.field + '"][style="display: none;"]');
/* Loop over the messages */
for (var i in messages) {
if (errorField[1] == undefined) {
var newErrorContainer = document.createElement("small");
$(newErrorContainer).attr("class", "swa-form-input__error-message swa-headline-sans--supertiny");
$(newErrorContainer).attr("data-field", data.field);
$(newErrorContainer).attr("data-fv-validator", "callback");
$(newErrorContainer).attr("data-fv-for", $(data.element[0]).attr("name") );
$(newErrorContainer).attr("data-fv-result", "INVALID");
$(newErrorContainer).attr("data-tracked", "true");
$(newErrorContainer).html(messages[i]);
if (errorContent.text().includes(messages[i])) {
$(newErrorContainer).hide();
}
errorContent.append(newErrorContainer);
}
}
}
})
.on('success.field.fv', function(e, data) {
/*
* On success field validation, enable submit button.
* Source: https://old.formvalidation.io/examples/enabling-submit-button/
*/
data.fv.disableSubmitButtons(false);
/* Remove the field messages */
$errorContent = data.element.closest('.form-combo-molecule').find('.errors');
$errorContent.find('.swa-form-input__error-message[data-field="' + data.field + '"]').remove();
$errorContent.find('.swa-form-input__error-message[data-fv-result="INVALID"]').removeAttr("style");
})
.on('success.form.fv', function() {
var formId = 'registerWithMembershipNumber';
if (!formId || formId === 'cfRequest' || formId === 'cfResponse') {
formId = 'scRegisterWithMembershipNumberFormDefinition';
}
ACC.tracking.pushFormSubmit(formId);
});
var replaceDatePatternWithValue = function(mandatory, fieldConfigCode, fieldConfigPattern) {
var date = fieldConfigPattern.toUpperCase();
var year = $("#" + fieldConfigCode + "_year").val();
var month = $("#" + fieldConfigCode + "_month").val();
var day = $("#" + fieldConfigCode + "_day").val();
date = date.replace(/[Y]+/, year);
date = date.replace(/[M]+/, month);
date = date.replace(/[D]+/, day);
var hiddenDateField = $('.js-' + fieldConfigCode + '_hidden');
if (mandatory) {
hiddenDateField.val(date);
} else {
hiddenDateField.val(date == "" ? "" : date);
}
};
var triggerFormValidation = function(fieldId, mandatory, fieldCode, dateFormat) {
replaceDatePatternWithValue(mandatory, fieldCode, dateFormat);
$('.js-fieldCode').formValidation('revalidateField', 'values[fieldCode_'+ fieldId + ']');
};
var removeDateMoleculeError = function(molecule) {
if(molecule.hasClass('has-error')){
molecule.removeClass('has-error');
molecule.find('.help-block').find('span').remove();
}
};
Otrzymaj 10% zniżki* na pierwszy zakup na stronie swarovski.com
Bądź na bieżąco z trendami i dostawami
nowych kolekcji
Otrzymuj zaproszenia na wydarzenia związane z wyprzedażami
Zyskaj możliwość szybszego dokonywania płatności i dodawania produktów do listy życzeń