I have a problem in my visualforce page, while rerendering the page, by clicking any button/ any request is sent to controller.
Visualforce page is:
apex:page controller="selectController">
<apex:pageblock >
<apex:form >
<apex:pagemessages />
<apex:repeat value="{!setOfSection}" var="section">
<br/>
<apex:pageBlocksection title="{section}">
<apex:variable value="{!mapOfSectionandItsClass[section]}" var="listOfInnerclass"/>
check:
<apex:repeat value="{!listOfInnerclass}" var="Innerclass"><br/>
<apex:selectList value="{!Innerclass.value}" multiselect="true" size="1">
<apex:selectoptions value="{!Innerclass.listOfdropdown}"/>
</apex:selectList>
</apex:repeat>
</apex:pageBlocksection>
</apex:repeat>
<apex:commandButton value="Check" action="{!check}"/>
</apex:form>
</apex:pageblock>
</apex:page>
Controller is:
public class selectController {
public Map<String,List<InnerClass>> mapOfSectionAndItsClass{get;set;}
public set<String> setOfSection{get;set;}
public selectController(){
mapOfSectionAndItsClass = new Map<String,List<Innerclass>>();
setOfSection = new set<STring>();
for(Innerclass__c newContact:[SELECT Name,Low__c,Medium__c,High__c,Section__c from Innerclass__c where section__c!=NULL]){
List<InnerClass> listOfInnerClass = new List<InnerClass>();
if(mapOfSectionAndItsClass.containsKey(newcontact.section__c)){
listOfInnerClass = mapOfSectionAndItsClass.get(newContact.section__c);
}
Innerclass newInnerclass = new Innerclass();
newInnerclass.listOfDropdown= new List<SelectOption>();
newInnerclass.listOfDropdown.add(new SelectOption(newContact.Low__c,newContact.Low__c));
newInnerclass.listOfDropdown.add(new SelectOption(newContact .Medium__c,newContact.Medium__c));
newInnerclass.listOfDropdown.add(new SelectOption(newContact.High__c,newContact.High__c));
listOfInnerClass.add(newInnerclass) ;
mapOfSectionandItsClass.put(newContact.section__c,listOfInnerclass);
}
setOfSection = mapOfSectionandItsClass.keyset();
}
public pageReference check(){
return NULL;
}
public class InnerClass{
public String value{get;set;}
public List<selectOption> listOfDropdown{get;set;}
}
public class Innerclass2{
public string section{get;set;}
public List<Innerclass> listOfInnerclasses{get;set;}
}
}
Its loading fine with all the Innerclass and its options.
When i click the button, its throwing error as
(Id of the selectList):Validation error: value is not valid
This error is throwing other than last section.
could you please pin point the error in this page/classes, and help me to solve this..
Thanks..