0

I want to retrieve the list of inputboxes(sessions) selected after saving the form. Below is the code I am using.

Page:

<apex:page controller="listex">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!sessions}" var="a">
                 <apex:column value="{!a.numb}"/>
                 <apex:column value="{!a.str}"/>
                 <apex:column ><apex:inputcheckbox /></apex:column>
            </apex:pageBlockTable>
            <apex:commandButton value="save" action="{!save}"/>
        </apex:pageBlock>
    </apex:form>
    <!--Get the list of sessions selected after save is clicked-->
</apex:page>

Controller:

public class listex {
    public list<s> inte;

    public list<s> getsessions(){
    list<s> inte = new list<s>();
        for(integer i=1;i<4;i++) {
            inte.add(new s(i,'session'+i));  
        }
        return inte;
    }

    public class s{
        public integer numb{get;set;}
        public string str{get;set;}
        public s(integer i, string s){
            this.numb = i;
            this.str = s;
        }
    }

    public pagereference save(){
        return null;
    }

}

Thanks.

1 Answer 1

1

You don't say what problem you are having with this, but I do see that you are not binding a variable to your checkbox.

<apex:column ><apex:inputcheckbox /></apex:column>

There's a working example of this here. The key line is

<apex:inputCheckbox value="{!c.selected}"/>

but the supporting wrapper class is needed as well.

1
  • Thanks Jagular. That is something I am trying to do. Let me try that and get back. Thanks
    – sf_user
    Apr 30, 2015 at 16:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .