You need to sign in to do that
Don't have an account?
Cindy Norman
How do i get iCheckBox selected= to work?
I’ve tried so many ways to try to make this work but can’t get it to behave. Other posts seem to indicate that this doesn’t work. But i really need it so here goes..
In the apex controller code MainControllerClass…
When i check the value of ABCCheckbox, it is indeed checked if the user checks it. I just can’t load the page with it already checked.
In the apex controller code MainControllerClass…
public Boolean ABCCheckbox {get; set;} public Boolean IsABC { get{if (appl==null) return false; if (appl.rating__c==‘ABC’) return true; return false;} set;} …startup, so not null or otherwise wonky... ABCCheckbox = false; …later & before page loads, ABCCheckbox set true… if (appl.rating__c==‘ABC’) ABCCheckbox = true;In the page...
<apex:page controller="MainControllerClass" > <apex:form id="abcForm"> <apex:pageBlock > <apex:outputPanel styleClass="panelWrapper" layout="block"> … <apex:outputPanel id="abcDetailPanel" layout="block"> <apex:pageblocksection id="abcDetail"> … <apex:pageBlockSectionItem > <apex:outputLabel value=“Check if ABC applies?”/> <apex:inputCheckbox value="{!HBCheckbox}" selected="{!IsABC}"/> </apex:pageBlockSectionItem> … </apex:pageblocksection> </apex:outputPanel> ... </apex:outputPanel> </apex:pageBlock> </apex:form> </apex:page>I've also tried this...
<apex:pageBlockSectionItem > <apex:outputLabel value=“Check if ABC applies?”> <apex:outputPanel layout="block"> <apex:actionRegion > <apex:inputCheckbox value="{!ABCCheckbox}" selected="{!IF(appl.rating__c==‘ABC’,true,false)}" > </apex:actionRegion> </apex:outputPanel> </apex:pageBlockSectionItem>…and if i do this, it is checked but that doesn’t help except shows me “selected” *can* work sometimes…
<apex:pageBlockSectionItem > <apex:outputLabel value=“Check if ABC applies?”> <apex:outputPanel layout="block"> <apex:actionRegion > <apex:inputCheckbox value="{!ABCCheckbox}" selected=“true” > </apex:actionRegion> </apex:outputPanel> </apex:pageBlockSectionItem>
When i check the value of ABCCheckbox, it is indeed checked if the user checks it. I just can’t load the page with it already checked.
in your visualfroce do this
<apex:inputCheckbox value="{!ABCCheckbox}">
Remove isABC. move that getter logic to the getter of ABCCheckbox. and it should work
The field needs to reflect the appl.rating__c value in my object.
The problem is: when i load or reload the page with the appl record, the checkbox is unchecked even though the rating__c = true.
In your constructor set rating__c to 'ABC' or null depending on your requirement so you have a defautl value if necessary. then do the follwoing on your ABCCheckbox
There seems to be no way to have inputCheckBox conditionally set.
But could you ever load or reload and have it checked? I'd love to see an example of that because i've tried all sorts of craziness and many days just for this silly checkbox.
Or do you just use it to grab whether the user checked it and then move on?
You're using logic like i do...but i'm convinced that it simply doesn't work.
In your page
Modify the appl sObject name as necessary and your method that you call from the button.
So in the example above, when user fills out the result__c value and click the button, it sets ABCCheckbox value and refreshes the checkbox so the new value is shown
But this concentrates on gathering whether the use checked the box or not. Which isn't the problem. That works just fine.
My problem is displaying the box correctly clicked or not clicked upon page load/reload.
(Am i missing something?)
Displaying my list of values isn't the problem.
Displaying a checkbox correctly is the problem.
What i mean is:
In this example, i now have 3 things for the input and display of the value rather than just a small little checkbox. rating__c is a picklist of values so i have a dropdown list. I have a checkbox that doesn't update (but WILL gather the check appropriately) and i have a submit button.
***What i need is the checkbox to be checked when appropriate. Then i don't need the rest nor clutter my screen and confuse the user.***