# apex:inputcheckbox "selected" attribute not working inside repeat tag

The "selected" attribute can be used to define if a checkbox should be checked by default when it is displayed on a Visualforce Page.

This works correctly when defined in a simple single apex:inputcheckbox tag in a form, but when this tag is present inside a repeat tag, the selected attribute has no affect. See the following example code:

<apex:form>       Single Checkbox:<br/>   <apex:inputCheckbox selected="true"/>        <br/><br/>Repeated Checkbox:<br/>   <apex:repeat value="{!availableProducts}" var="myVar">       <apex:inputCheckbox selected="true"/>   </apex:repeat> </apex:form> 


Here is the resulting output when I load the page:

As you can see, the repeated checkbox doesn't get automatically selected. When inspecting the html, I see that the "checked" value doesn't get set in these repeated checkboxes like it does with the singular version. Am I missing something in terms of correct usage, or is this a problem with the attribute?

Replay

Category: visualforce Time: 2016-07-30 Views: 0

## Related post

• apex:inputCheckBox selected attribute is not working 2014-06-24

i write a small snippet related to apex:inputCheckBox <apex:inputCheckbox onclick="callRemoteFunction(this,{!num})" selected="{!isItemSelected}"/> i am facing error Unknown function isItemSelected. Check spelling in my custom con

• apex inputCheckbox required=TRUE not working 2015-03-20

I have an with required="TRUE". For some reason it isn't getting throwing error even if I save it without checking the box. Here's the VF Code. <apex:outputPanel styleClass="margin-t3" layout="block" > <div class=&qu

• HTML Select "Selected" attribute not working 2016-01-17

I'm generating a list of colors with Angular, using the following code: <select id="color" ng-model="bgCol"> <option ng-selected="{{ind == 0}}" ng-repeat="(ind, color) in colors" value="{{ind}}"&g

• Javascriprt ternary operator not working inside input tag 2016-02-09

I have javascript which returns true / false which eventually determines whether a checkbox will be checked or not. Below are the code. But is is not behaving as expected. This code sets profiles value to checked instead of being a attribute value. C

• Notepad++ spellcheck not work with "comment tag" 2014-09-09

I am using plugin DSpellCheck in Notepad++ When editing an XML file I noticed that the spell checker does not check inside the "CDATA", like this: <![CDATA[My testt]]> What causes this is the exclamation mark (!) Other example not work: &l

• javascript not working inside ajax loaded bootstrap modal 2016-01-30

Basically, i am trying to implement the database edit option on ajax loaded bootstrap modal window.The problem is my plugins (Datepicker, Clockpicker and select2) are not working inside the ajax loaded bootstrap modal. But the values are being passed

• Why \ifnum\[email protected] does not work inside tabular? 2013-04-23

Why \ifnum\[email protected] does not work inside tabular? Should not I get no footnote-rule? I am just puzzled! \documentclass{article} \begin{document} \makeatletter \long\def\@mpfootnotetext#1{% \ifnum\[email protected]=\@ne\let\footnoterule\relax\fi \globa

• Why does \vfill not work inside minipage? 2013-09-27

Perhaps the answer is trivial, and I am facing the scenario as part of a larger macro. I faced a situation where I found that \vfill does not work inside minipage environment. The extracted code from the bigger picture can be minimized to the followi

• Drupal_add_js is not working inside hook submit 2014-08-19

I have alter and hook submit for webform. I would like to pop a modal if form is successfully submitted. But drupal_add_js seemed to be not working inside the hook submit. function myModule_form_alter(&$form, &$form_state, $form_id) { if($form_id

• fillbetween from pgfplots does not work inside groupplots 2014-10-16

MWE: \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=newest} \usepgfplotslibrary{groupplots} \usepgfplotslibrary{fillbetween} \usepackage{filecontents} \begin{filecontents}{testdata.dat} t lineLow lineHigh

• hspace not working inside mdframed 2015-05-17

I am trying to use \hspace to align text inside mdframed box. However, \hspace seems to not working inside mdframed box. Text in the mdframed is somehow is aligned to center. Why is \hspace not working here ? \usepackage[framemethod=TikZ]{mdframed} \

• Angular js $scope is not working inside Jquery function 2016-02-11 I'm using Sweet alert for alert messages. I have confirmation alert box is there, after confirmation i have disable my content but that is not disable$scope is not working inside swal() if clicked twice it is working.how can i make it work. My HTML

• apex:inputText not working inside nested apex:repeat tags 2015-06-24

I am trying to have multiple text-boxes inside a table cell. I am creating the table using apex:repeat tag and the multiple text-boxes using another apex:repeat tag nested in the earlier one. The starts throwing Unknown property exception during savi

• Does the assignTo attribute of apex:attribute not work for ApexPages.Action or PageReference types? 2013-03-08

How would you pass a PageReference attribute to a custom component and have it assign to a variable on the component's controller? It seems like the assignTo attribute of apex:attribute does not work for ApexPages.Action or PageReference types. See t

• Directive not working inside ng-repeat? 2016-02-12

I am building a multiple image upload tool for various scenarios where a user can have 1 - 4 images. My Directive (ng-img-crop) crop.directive('imgCrop', ['$timeout', 'cropHost', 'cropPubSub', function($timeout, CropHost, CropPubSub) { return { restr

• ng-if is not working inside ng-repeat in when bind-html-compile 2016-07-14

I have the below code to bind html in my html page, <div bind-html-compile="menuButtonView"></div> I have the below code in my controller, dashboardService.getTemplateMetaData(data.templateCategory) .success(function(data) { console.

• Windows 7 64bit stuck on language select: USB3 not working? 2015-06-09

I decided that I wanted to put Windows onto this MacBook. So I went and began to partition my harddrive in a way that I could tripple-boot easily. So then I created the boot drive using the Boot Camp assistant. Once done, I booted into Windows. I had

• OutputPanel Rendered Attribute not working as expected 2016-01-19

I've got a Quote Calculator in the works for my company and I'm trying to have it push the quote out as a PDF. Where I am running into the issue is with the PDF page. Both pages use the same output panel code, and the same extension to get and render

• selectOption not working inside pageBlockSection 2013-04-12

I have a selectOption inside a pageblocksection as follows <apex:page standardController="Account" extensions="MyController"> <apex:form> <apex:pageBlock> <apex:pageBlockSection> <apex:selectList value="