• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

logic:iterate & input issue

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm hoping someone would be kind enough to help me out. Currently, we are using logic:iterate to loop through a
listarray. That works fine. But now I need to give the user the ability to change the quantite field. I tried with
a input text but that did not work, no matter what the user entered, the original quantity is still sent to the server.

I've tried searching for help on this but all I found was samples on how to display data only.

Any help would be appreciated.

 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Madrid,
Expecting that your are using struts version 1.x, could you try using html:text instead of simple html tag and see if it works out. use something like below.This should work. If this doesnt work out do a rightClick on UI -> view source code and get the relevant code and post the same.
 
Leo Madrid
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shankar,
Thanks very much for your help.

I tried what you suggested and it half worked. "quantite" in listArray "produitsTransfert"
is still not being updated. Instead, what it does is a new parameter array of "produit" is being
sent with the the new values. See below.

Do you know if there is another solution, if not, I'll just synchronize the data manually in the code.

Thanks Again
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Madrid,
Could you post the iteration code generated in HTML (as mentioned before, do a view source in the UI and get the iterate part of the tags- just for one iteration is enough). I just want to see how the loop is being considered.
 
Leo Madrid
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Shankar Tanikella wrote:Hi Madrid,
Could you post the iteration code generated in HTML (as mentioned before, do a view source in the UI and get the iterate part of the tags- just for one iteration is enough). I just want to see how the loop is being considered.



Here is the html source code. Thanks for your help.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Madrid,
Yes, that's how it work. The whole logic actually doesn't update any array list but it creates one. Since the "id" for the iterate is mentioned as "produit" we get produit array list. We can still use that, since we are getting the values in array format we can include other params as well into it. For example, I hope then it would give you a complete produit array list which you can use. This should at least work out

Anyways,

Leo Madrid wrote:if not, I'll just synchronize the data manually in the code.

What is meant by this? How can it be an alternative
 
Leo Madrid
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Shankar Tanikella wrote:

Leo Madrid wrote:if not, I'll just synchronize the data manually in the code.

What is meant by this? How can it be an alternative


Thanks for you help Shakar. I think my Struts expertise is sorely lacking. In the code, produitsTransfert is a listArray which holds beans of type TransfertItem. TransfertItem has member variables pack, code and quantite. So I was hoping that whatever the user entered in the quantite field, would be updated automatically in the produitsTransfert listArray.

What your suggestion does is send new parameters of type produit : "produit[0].quantite ", "produit[1].quantite" which hold the quantite values that the user entered.

So what I meant with "I'll just synchronize the data" is that I will take the value of each "produit[x].quantite" and update the appropriate produitsTransfert record.

Thanks for you help

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!