Skip to content

Commit

Permalink
LPS-125128 prevent submitting form if default value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosapmf committed Jan 15, 2021
1 parent 9abb541 commit 2cb2276
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -148,19 +148,27 @@ editDDMStructureURL.setParameter("mvcPath", "/edit_data_definition.jsp");
'<portlet:namespace />name'
);

if (!nameInput.value) {
var name = <portlet:namespace />getInputLocalizedValues('name');

if (
!nameInput.value ||
!name[
'<%= journalEditDDMStructuresDisplayContext.getDefaultLanguageId() %>'
]
) {
Liferay.Util.openToast({
message:
'<liferay-ui:message key="please-enter-a-valid-name" />',
title: '<liferay-ui:message key="error" />',
type: 'danger',
});

return;
}

var description = <portlet:namespace />getInputLocalizedValues(
'description'
);
var name = <portlet:namespace />getInputLocalizedValues('name');

var formData = dataLayoutBuilder.getFormData();

Expand Down

0 comments on commit 2cb2276

Please sign in to comment.