META-INF.resources.edit_region.jsp Maven / Gradle / Ivy
<%--
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
--%>
<%@ include file="/init.jsp" %>
<%
long regionId = ParamUtil.getLong(request, "regionId");
Region region = RegionLocalServiceUtil.fetchRegion(regionId);
String backURL = ParamUtil.getString(request, "backURL", String.valueOf(renderResponse.createRenderURL()));
portletDisplay.setShowBackIcon(true);
portletDisplay.setURLBack(backURL);
renderResponse.setTitle((region == null) ? LanguageUtil.get(request, "add-region") : LanguageUtil.format(request, "edit-x", region.getTitle(LocaleUtil.toLanguageId(locale)), false));
%>
var form = document.getElementById(' fm');
if (form) {
var nameInput = form.querySelector('# name');
var titleInput = form.querySelector('# title');
if (nameInput && titleInput) {
var handleOnTitleInput = function (event) {
var value = event.target.value;
if (nameInput.hasAttribute('maxLength')) {
value = value.substring(0, nameInput.getAttribute('maxLength'));
}
nameInput.value = value;
};
titleInput.addEventListener(
'input',
Liferay.Util.debounce(handleOnTitleInput, 200)
);
}
}