You need to sign in to do that
Don't have an account?
msb-appsupport1.3905906418879758E12
Cannot update the selected field of checkbox
The problem I got is I could not update the selected field.
It seems when I check the checkbox, the value {!tItem.selectedCheck} and {!tItem.selectedUnCheck} could not got update.
Could anyone tell me how to solve it?
Thanks so much.
The following is my code:
<!-- display the result and check-in -->
<apex:pageblockSection columns="2" id="result_section">
<apex:pageblockTable value="{!ticket_result_list}" var="tItem" id="result_table">
<apex:column headerValue="Ticket Search Result">
<apex:outputText value="No result" rendered="{!NOT(found)}"/>
<apex:outputText value="{!tItem.ticket.name}" rendered="{!found}"/>
</apex:column>
<!-- check box to select which the user want to check-->
<apex:column headerValue="Check-in">
<apex:inputCheckbox value="{!tItem.selectedCheck}"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:inputCheckbox value="{!tItem.selectedUncheck}"/>
</apex:column>
<!--
<apex:column headerValue="Check-in">
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:column>
-->
</apex:pageblockTable>
</apex:pageblockSection>
<p />
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
<p />
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:pageBlock>
--------------------------------------------------------------------------------------------------------------------------------
//check button and uncheck button
public PageReference check() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == True) {
selectTic.ticket.sbxe1__sbx_Attended__c = TRUE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public PageReference uncheck() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == FALSE && selectTic.selectedUncheck == TRUE) {
selectTic.ticket.sbxe1__sbx_Attended__c = FALSE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public class DisplayTicket {
public sbxe1__Ticket__c ticket {
get; set;
}
public Boolean selectedCheck {
get; set;
}
public Boolean selectedUncheck {
get; set;
}
public DisplayTicket(sbxe1__Ticket__c item) {
this.ticket = item;
selectedCheck = false;
selectedUncheck = false;
//this.no_found_msg = 'No result';
}
public String name {
get {return ticket.Name;}
}
public String no_found_msg {
get {return 'No result';}
}
}
It seems when I check the checkbox, the value {!tItem.selectedCheck} and {!tItem.selectedUnCheck} could not got update.
Could anyone tell me how to solve it?
Thanks so much.
The following is my code:
<!-- display the result and check-in -->
<apex:pageblockSection columns="2" id="result_section">
<apex:pageblockTable value="{!ticket_result_list}" var="tItem" id="result_table">
<apex:column headerValue="Ticket Search Result">
<apex:outputText value="No result" rendered="{!NOT(found)}"/>
<apex:outputText value="{!tItem.ticket.name}" rendered="{!found}"/>
</apex:column>
<!-- check box to select which the user want to check-->
<apex:column headerValue="Check-in">
<apex:inputCheckbox value="{!tItem.selectedCheck}"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:inputCheckbox value="{!tItem.selectedUncheck}"/>
</apex:column>
<!--
<apex:column headerValue="Check-in">
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
</apex:column>
<apex:column headerValue="Uncheck">
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:column>
-->
</apex:pageblockTable>
</apex:pageblockSection>
<p />
<apex:commandButton action="{!check}" value="Check-in" reRender="result_table"/>
<p />
<apex:commandButton action="{!uncheck}" value="Uncheck" reRender="result_table"/>
</apex:pageBlock>
--------------------------------------------------------------------------------------------------------------------------------
//check button and uncheck button
public PageReference check() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == True) {
selectTic.ticket.sbxe1__sbx_Attended__c = TRUE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public PageReference uncheck() {
List<DisplayTicket> selectedTickets = new List<DisplayTicket>();
for(DisplayTicket selectTic: getTicket_result_List()) {
if(selectTic.selectedCheck == FALSE && selectTic.selectedUncheck == TRUE) {
selectTic.ticket.sbxe1__sbx_Attended__c = FALSE;
update selectTic.ticket;
}
}
selectedTickets = null;
return null;
}
public class DisplayTicket {
public sbxe1__Ticket__c ticket {
get; set;
}
public Boolean selectedCheck {
get; set;
}
public Boolean selectedUncheck {
get; set;
}
public DisplayTicket(sbxe1__Ticket__c item) {
this.ticket = item;
selectedCheck = false;
selectedUncheck = false;
//this.no_found_msg = 'No result';
}
public String name {
get {return ticket.Name;}
}
public String no_found_msg {
get {return 'No result';}
}
}
Please refer following thread with this requirement:
https://developer.salesforce.com/forums/ForumsMain?id=906F0000000906SIAQ