掲示板

TextBoxList - Validation

thumbnail
11年前 に dave ch によって更新されました。

TextBoxList - Validation

Regular Member 投稿: 161 参加年月日: 12/02/07 最新の投稿
Hi all,

There is a categorization section when we select any web content from control panel. Basically, we can add tags from the Tags section.
When we are trying to add any Tag in the TextBoxList which was already inserted before, it is not showing any warning message. Actually, when i am trying to add any existing Tag in the TextBoxList , it is not getting added, but at the same time it is not throwing any warning message also.
I want to show a warning message when any user want to add any existing tag.

There is one jsp inside journal (tomcat-7.0.27\webapps\ROOT\html\portlet\journal\article) and there is one row as below:

<aui:input classPK="<%= classPK %>" name="tags" type="assetTags" >

Now, how should i validate this field using </aui:validator>

Or there should be any other way to go? How to achieve this functionality?
thumbnail
11年前 に dave ch によって更新されました。

RE: TextBoxList - Validation

Regular Member 投稿: 161 参加年月日: 12/02/07 最新の投稿
Hi all,

I need to customize this jsp: html\taglib\ui\asset_tag_selector\page.jsp to show a warning message when any user want to add any existing tag. If I am not wrong.

This is where i am getting my tags which is being inserted from web content--> categorization-->Tags: curTags

if (Validator.isNotNull(className) && (classPK > 0)) {
List<AssetTag> tags = AssetTagLocalServiceUtil.getTags(className, classPK);
curTags = ListUtil.toString(tags, AssetTag.NAME_ACCESSOR);
}

String curTagsParam = request.getParameter(hiddenInput);
if (curTagsParam != null) {
curTags = curTagsParam;
}
%>
<div class="lfr-tags-selector-content" id="<%= namespace + id %>assetTagsSelector">
<aui:input name="<%= hiddenInput %>" type="hidden" />
<input class="lfr-tag-selector-input" id="<%= id %>assetTagNames" size="15" title="<liferay-ui:message key="add-tags" />" type="text" />
</div>

Below is the script :

<aui:script use="liferay-asset-tags-selector">

var select = A.one('#<portlet:namespace />&lt;%= namespace + id %&gt;assetTagsSelector');
alert(select);

	new Liferay.AssetTagsSelector(
		{
			allowSuggestions: &lt;%= PropsValues.ASSET_TAG_SUGGESTIONS_ENABLED %&gt;,
			contentBox: '#&lt;%= namespace + id %&gt;assetTagsSelector',

			<c:if test="<%= PropsValues.ASSET_TAG_SUGGESTIONS_ENABLED &amp;&amp; Validator.isNotNull(contentCallback) %>">
			
				contentCallback: function() {
					if (window.&lt;%= contentCallback %&gt;) {
					
						return &lt;%= contentCallback %&gt;();
					}
				},
			</c:if>

			curEntries: '&lt;%= HtmlUtil.escapeJS(curTags) %&gt;',
			focused: &lt;%= focus %&gt;,
			hiddenInput: '#&lt;%= namespace + hiddenInput %&gt;',
			input: '#&lt;%= id %&gt;assetTagNames',
			instanceVar: '&lt;%= namespace + id %&gt;',
			portalModelResource: &lt;%= Validator.isNotNull(className) &amp;&amp; (ResourceActionsUtil.isPortalModelResource(className) ||                                       className.equals(Group.class.getName())) %&gt;
		}
	).render();
</aui:script>


Now, how should I get the tag which is being most recently inserted?

Any help would be appreciated.

Thanks and Regards
thumbnail
11年前 に dave ch によって更新されました。

RE: TextBoxList - Validation

Regular Member 投稿: 161 参加年月日: 12/02/07 最新の投稿
Any body?