Hello there! I have a web project in which I'm using struts2 + jquery plugin.
I really like the autocompleter component since as you may know, it starts
filtering its content while we type on it.
The thing is that it does not submit the latest selected values in the
others elements at the jsp like s:select, while typing in it. So when
url_products is called, an old value for the provider.id is sent to the
action.

JSP:

<s:form id='myForm'>

<s:url id="url_products" action="purchaseNavegation" method="showProducts"/>

<s:select list="providers" value="purchase.provider.id" listKey="id"
name="purchase.provider.id"/>

<sj:autocompleter 
id="productId" 
name="productDescription" 
value="%{productDescription}" 
listenTopics="providerChanged"
href="%{url_products}"
formIds="myForm" 
/>


Code in the struts action:

public void setPurchase(Purchase purchase) {
this.purchase = purchase;
}

public Purchase getPurchase() {
return this.purchase;
}

public List<Provider> getProviders() {
return this.providerService.getAllProviders();
}

public String[] getAllProducts() {
List<String> productsDescriptions = new ArrayList<String>();
if (term != null && term.length() > 0)
{
List<Product> products = new ArrayList<Product>();
products = this.productService.getAllProducts();
for (Product product : products) {
String descriptionProduct = product.getDescription();
if (StringUtils.contains(descriptionProduct.toLowerCase(),
term.toLowerCase()))
{
productsDescriptions.add(descriptionProduct);
}
}
}
return productsDescriptions.toArray(new
String[productsDescriptions.size()]);
}

public String getProductDescription(String productDescription) {
return this.productDescription;
}

public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}

public String showProducts() {
return "showProducts";
}


struts.xml:

<action name="purchaseNavigation" class="purchaseNavigationAction">
<result name="showProducts" type="json">
allProducts
</result>
</action>



Why are the latest selected values of the s:select are not sent to the
action when the url is called? Any ideas? 

--
View this message in context: 
http://struts.1045723.n5.nabble.com/struts2-jquery-autocompleter-is-not-working-tp4784544p4784544.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to