You need to sign in to do that
Don't have an account?
Superdome
Strange Bug of the apex:inputCheckbox
Try the codes.
With value=.... in the apex:inputCheckbox, all of the commandLink and commandButton doesn't work.
Even the commandButton in the case, it is not related to the inputCheckbox at all. But it is just unable to open the pageReference url as it should be.
Without value=.... the commandLink and commandButton just works fine.
Is it bug ?
VF:
<apex:page controller="SelectRadio" sidebar="false"> <apex:outputPanel id="outputPanel"> <apex:form > <apex:dataTable border="4" value="{!ords}" var="o"> <apex:column > <apex:commandLink action="{!SelectTicket}" reRender="outputPanel"> <apex:inputCheckbox value="{!ordsOptions[o]}"/> <apex:param name="selected" value="{!o.id}" assignTo="{!selected}"/> </apex:commandLink> </apex:column> <apex:column value="{!o.Id}"/> <apex:column value="{!o.Name}"/> </apex:dataTable> <apex:commandButton action="{!rSfdc}" value="按鍵"/> </apex:form> <hr/> <h1>Debug</h1> <p>ordsOptions = {!ordsOptions}</p> <p>ordsOptionName = {!ordsOptionName}</p> <p>selected = {!selected}</p> </apex:outputPanel> </apex:page>
Class:
public with sharing class SelectRadio { public List<String> vars {get;set;} public List<Custom_Object__c> ords {get; set;} public Map<Id,Boolean> ordsOptions {get; set;} public Map<Id,String> ordsOptionName {get; set;} public Id selected {get;set;} public SelectRadio(){ ordsOptions = new Map<Id,Boolean>(); ordsOptionName = new Map<Id,String>(); ords = [ SELECT Id, Name FROM Custom_Object__c ORDER BY Name ]; for (Custom_Object__c tmp : ords) { ordsOptions.put(tmp.Id, false); ordsOptionName.put(tmp.Id, tmp.Name); } } public pageReference SelectTicket() { return null; } public PageReference rSfdc() { PageReference rp = new PageReference('http://www.salesforce.com'); rp.setRedirect(true); return rp; } }
The same case, and new findings.....
It looks really like a bug.
It doesn't work at all when add the inputCheckbox in another column.
The almost same code just works fine, and it can work if and only if DON'T USE inputCheckbox
Finally, I found myself the answer.
It's not a bug at all !!
It can be used as the function of selectRadio and more flexible than the selectRadio.
The sample pattern is easily to use with apex:dataTable and apex:repeat.
The workable pattern code:
vf:
class: