struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "RamKumar" <ramkum...@tarangtech.com>
Subject html:multibox problem!!
Date Thu, 02 Sep 2004 05:46:07 GMT
Hi,
I have a question and 4 choices.You can select multiple answers for single question. I want
to do skiplogic for this question .i.e. when the users selects choices 1 & 3 go to 5th
page.Like this there will be multiple combinations(we limited to 4 combinations for  4 choices
question)


I am representing this in a  4 * 4 matrix form in my jsp page using checkboxes. There will
be totally 16 checkboxes. What happens is whenever i choose a checkbox which is present in
a position (1,1) and applies that logic and when i come back again to the same page for editing,
checkbox in position(1,0) is checked instead of checkbox(1,1). Why it is happening like this?.

Any clues?.

This is my JSP code.
....
<html:multibox name="SurveyCreateForm" property="pageValue[${pageNo}].questionValue[${questionNo}].skipLogic[${status.index}].selectedChoices[${status1.index}][${status2.index}]"
value="${sessionScope.SurveyCreateForm.pageList[pageNo].questionList[questionNo].skipLogicList[status.index].selectedChoices[status1.index][status2.index]}"
javascript:disableOthers(${status1.index});"/>
....


This is my form 

private String[][] selectedChoices = null;
/**
 * @return Returns the selectedChoices.
 */
public String[][] getSelectedChoices() {
 return this.selectedChoices;
}
/**
 * @param selectedChoices The selectedChoices to set.
 */
public void setSelectedChoices(String[][] selectedChoices) {
 this.selectedChoices = selectedChoices;
}

public String getSelectedChoices(int index, int index1) {
 String choice = "";
 if (selectedChoices != null && selectedChoices.length > 0)
  choice = selectedChoices[index][index1]; 
 return choice;
}

public void setSelectedChoices(int index, int index1, String value) {
 addToArray(selectedChoices, index, index1, value);
}

To my surprise, the above indexed property methods are not getting called

-----

This is how i am initializing the above form property in my action class for the first time

selectedChoices = new String[choice.size()][];
for (int i=0;i<choice.size();i++) {
 selectedChoices[i] = new String[choice.size()];
}
skipForm.setSelectedChoices(selectedChoices);



thanks,
Ramkumar



   
   
   
   

   
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message