Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Liferay 7.2 - How to get the aui:select index?
Hi,
I have the following view.jsp:
My goal is to change the Product Description when we select something from the aui:select. I was thinking that maybe, if I can get the selected index, I could change the value of the label by using something like this:
How can I get the select index of my aui:select? I think that I also need the changesContext param to update the values?
I have the following view.jsp:
<%@ include file="/init.jsp" %>
<%@ page import="java.util.List" %>
<%@ page import="packagename.servicebuilder.service.ProductLocalServiceUtil" %>
<%@ page import="packagename.servicebuilder.model.Product" %>
<% List<product> products = ProductLocalServiceUtil.getProducts(0, ProductLocalServiceUtil.getProductsCount()); %>
<aui:select label="Delete Product" name="productId">
<% for (Product product : products) { %>
<aui:option value="<%= product.getProductId() %>"><%= product.getProductName() %></aui:option>
<% } %>
</aui:select>
<aui:input label="Product Description" value="this should change" type="text" readonly="true" /></product>
My goal is to change the Product Description when we select something from the aui:select. I was thinking that maybe, if I can get the selected index, I could change the value of the label by using something like this:
<aui:input label="Product Description" value="<%= products.get(aui:select:index).getProductDescription() %>" type="text" readonly="true" />
How can I get the select index of my aui:select? I think that I also need the changesContext param to update the values?
Hi, May be you can have hidden input tag for description and onChange() event show which this on.
<aui:input name="descrption<%=product.getProductId() %>" value="<%=product.getDescription() %>" type="hidden" />
function updateDesc() {
//Show description input tag
}
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™