Skip to content

Commit

Permalink
LPS-206323 Avoid hard coding - get max length for the name field from…
Browse files Browse the repository at this point in the history
… model hints
  • Loading branch information
pei-jung authored and brianchandotcom committed Jan 18, 2024
1 parent fecee3c commit 2c15429
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ portletDisplay.setShowBackIcon(true);
}
).put(
"name", name
).put(
"nameFieldMaxLength", ModelHintsUtil.getMaxLength(CTCollectionTemplate.class.getName(), "name")
).put(
"namespace", liferayPortletResponse.getNamespace()
).put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default function PublicationTemplateEditView({
descriptionFieldMaxLength,
getTemplateCollaboratorsURL,
name,
nameFieldMaxLength,
namespace,
publicationDescription,
publicationName,
Expand Down Expand Up @@ -129,6 +130,7 @@ export default function PublicationTemplateEditView({
componentType="input"
fieldValue={nameField}
label={Liferay.Language.get('name')}
maxLength={nameFieldMaxLength}
onChange={(event) => {
setNameField(event.target.value);
}}
Expand Down Expand Up @@ -265,8 +267,8 @@ export default function PublicationTemplateEditView({
disabled={
!nameField.length ||
!publicationNameField.length ||
nameField.length > 75 ||
publicationNameField.length > 75 ||
nameField.length > nameFieldMaxLength ||
publicationNameField.length > nameFieldMaxLength ||
(descriptionField &&
descriptionField.length >
descriptionFieldMaxLength) ||
Expand Down

0 comments on commit 2c15429

Please sign in to comment.