Hi Michael,

Thanks for your reply.
Now i have remove all my business logic and simply testing component. But my
bad luck continue same error. I have also attached my modified java and
jsp file. Please help me i am not able to find any way to come out of this
problem

I am using
Myfaces implementaion 1.1.5
Tomahawk 1.1.6

On business tier i am using Spring 2  and Hibernate 3
Thanks
Pavan Shahi
On Mon, Mar 24, 2008 at 9:09 PM, Michael Kurz <[EMAIL PROTECTED]> wrote:

> Pavan Shahi schrieb:
> > Trying to get h:selectManyChekbox running sine about 1 days, but I
> > always get a validation error when I select one of the checkboxes
> > Validation error : Value is not a valid option
> >
> > When I am doing hit and trail to fixed this problem I found that if I
> > put backing bean in session scope then it work fine. But I cant put bean
> > in session scope due to some other issues.
>
> Hi,
>
> I guess I have bad news for you. Your code is working for me - in
> request and session scope (it looked ok anyway).
>
> One issue that might lead to this behaviour is that the list of possible
> select items changes between the requests. This could explain why it is
> working in session scope but not in request scope. How does your getter
> for the list of select items look like?
>
> The validation error you get indicates that the list of selected items
> contains an element that is not in the list of select items.
>
> regards
> Michael
>
package com.recu.view.bean;

import java.util.ArrayList;
import java.util.List;

import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

import org.apache.myfaces.custom.fileupload.UploadedFile;

import com.recu.model.businessobject.Address;
import com.recu.model.businessobject.Candidate;
import com.recu.model.businessobject.Candidateskillset;
import com.recu.model.businessobject.Domain;
import com.recu.model.businessobject.Education;
import com.recu.model.businessobject.Skillset;
import com.recu.model.exception.ResumeUploadException;
import com.recu.model.service.CandidateService;
import com.recu.model.service.RecruitmentService;
import com.recu.model.util.ManagedBeanName;
import com.recu.model.util.RecruitmentUtil;
import com.recu.model.util.ServiceBeanName;
import com.recu.view.bulider.CandidateBeanBuilder;
import com.recu.view.util.FacesUtils;

public class CandidateViewEditBean extends BaseBean 
{
        private List<String> xyzSelected;
        private List<SelectItem> xyzOptionsList=new ArrayList<SelectItem>();
                
        public List<String> getXyzSelected() {
                return xyzSelected;
        }
        public void setXyzSelected(List<String> xyzSelected) {
                this.xyzSelected = xyzSelected;
        }


        public List<SelectItem> getXyzOptionsList() {
                return xyzOptionsList;
        }
        public void setXyzOptionsList(List<SelectItem> xyzOptionsList) {
                this.xyzOptionsList = xyzOptionsList;
        }

// Go to detail page here i am populating list

        public String viewDetail()
        {
                String nextView="candidateViewEditMain";
                
                
                xyzOptionsList=new ArrayList<SelectItem>();
                SelectItem item;
                SelectItem item1=new SelectItem("1","lab1");
                
                SelectItem item2=new SelectItem("2","lab2");
                
                xyzOptionsList.add(item1);
                xyzOptionsList.add(item2);
           
                return nextView;
        }
        

        
        public String updateCandidate()
        {
                
                return "candidateSearchMain";
        }
}
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t"%>
<div id="content">
        <f:view>
        <h:messages errorClass="error" infoClass="error" layout="table" 
globalOnly="true" showDetail="false" showSummary="true"/>       
        <h:form id="canVieEditForm" enctype="multipart/form-data"><!-- Skill 
set -->
                                        <table width="100%">
                                                
                                
                                                                
                                                        <h:selectManyCheckbox 
layout="pageDirection" value="#{candidateViewEditBean.xyzSelected}" 
id="skillSet">
                                                                        
<f:selectItems value="#{candidateViewEditBean.xyzOptionsList}"/>
                                                        </h:selectManyCheckbox> 
      
                                                        <t:message 
styleClass="error" for="skillSet" />
                                                
                                                 <tr>
                                                        <td><t:commandButton 
action="#{candidateViewEditBean.updateCandidate}" id="updateButton" 
value="Update" /></td>
                                                </tr>           
                                                                                
                                
                                        </table>
                                        
                                        
                                </td></tr>
                                
                  </table>
                        
                                        
        </h:form>                     
        </f:view>       
 </div>

Reply via email to