Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Radio buttons for each row in s iterator tags

 
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using s:iterator and need to put radio button on every row/record returned
This is my code :


The problem with the above code is that it displays accountNo e.g. 123, 456 etc. next to it's radio button. I need to remove it.
Please advise.
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you set the label parameter to ""?
 
Ranch Hand
Posts: 33
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pramod talekar wrote:Hi,

I'm using s:iterator and need to put radio button on every row/record returned
This is my code :


The problem with the above code is that it displays accountNo e.g. 123, 456 etc. next to it's radio button. I need to remove it.
Please advise.





Replace your radio button line with

<td><s:radio name="selectedId" list="#{'accountNo':''}" theme="simple"></s:radio></td>
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Shashank. It's working fine now.

Setting label didn't work Joe. Thanks for the response.
 
Greenhorn
Posts: 17
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Shashank Gollapudi wrote:
Replace your radio button line with

<td><s:radio name="selectedId" list="#{'accountNo':''}" theme="simple"></s:radio></td>


Doing so is displaying the radio button as desired.
But when i am selecting the radio button and sending request no value with radio button is sending.
How to do it.?
 
Ranch Hand
Posts: 40
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Gaurav Manral wrote:

Shashank Gollapudi wrote:
Replace your radio button line with

<td><s:radio name="selectedId" list="#{'accountNo':''}" theme="simple"></s:radio></td>


Doing so is displaying the radio button as desired.
But when i am selecting the radio button and sending request no value with radio button is sending.
How to do it.?



Well this was left unanswered since a long time and somehow I managed to stumble upon the same problem in one of my projects so felt like sharing out the solution with community. The way to do it is that you have to use an iterator like the one shown in the snippet below....



what essentially is happening is that your passing your list to the iterator and using the `top` keyword in the radio itself to extract the topmost element from the list and render it out as the part of the value attribute for the radio button.

Hope it helps.

Cheers!!
 
Always look on the bright side of life. At least this ad is really tiny:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic