Link to home
Start Free TrialLog in
Avatar of jaggernat
jaggernat

asked on

Getting correct value from multiple rows

hi guys

On my screen i have three rows (UserVO) , like this

ID   NAME    GROUP
--   ----    -----
1     Jay     T            
2     Jay     I            
3     Jay     P            


ID and NAME are text boxes and GROUP is a dropdown. So the basic functionality is
if user selects 'I' or 'P' from GROUP drop-down, Name field should become readonly. When user selects
T, the Name field should again become editable text box. so when user selects I or P, Jay becomes readonly and when user selects T, Jay becomes editable.

Basically i am displaying the above rows using java code (I am putting all the individual rows in a List and
iterating throught the list and displaying them ;

for(int row=0 ; row < List.size();row++)
{
UserVO user = (UserVO) List.get(cnt);
// get Group value
String group = form.getGroup();  getting the Group value here
if(groupType = I || groupType = P)
{
Disable the Name field
}

Basically here i want to get the Group value from individual rows and check if it is I or P or T individually for each row and then disable the name field for that row


but the problem is String group = form.getGroup(); will give the group value correctly just for the
first row.   The second and third row dont work because form.getGroup();   doesnt recognize those rows, so i am thinking may be i should pass some index instead of doing  String group = form.getGroup();

for(int row=0 ; row < List.size();row++)
{
...
String group = form.getGroup()[index of 1st / 2nd /3rd row]}
but i am not sure how to impliment this , any ideas will be greatly appreciated

thanks
J
Avatar of sanjooz
sanjooz

It works as expected. I bet your group drop down lists has the same name. So when you get the values with form.getGroup(), you get value of the last group drop down element.

To fix this, you will have to use an array(for example group[]) or different names for drop down lists (group1, group2 etc)
Avatar of jaggernat

ASKER

but if i have like 100 rows, i cannot have group1, group2 ...group100... thats practically not possible.
i want to use a single form.getGroup() and get the correct value for each row..

is that possible?
thanks
J
then you can use array group[]
ok..can you give me some sample code so i can understand what you are saying

thanks
J

SOLUTION
Avatar of Manish
Manish
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial