You need to sign in to do that
Don't have an account?
mustafatop
How to use apex:selectlist into apex:repeat?
s and s2 variables don't set selected value that is come from piclist in vf page when I use apex:selectlist tag in apex:repeat tag. So s and s2 are always '09:00'. When I remove apex:repeat tag, the problem is solved. But I need it.
How to solve this problem without save button into apex:repeat tag?
A piece of the the my code is following.
String s = '09:00'; String s2 = '09:00'; public String getSelectedItem(){ return s; } public void setSelectedItem(String s){ this.s = s; } public String getSelectedItem2(){ return s2; } public void setSelectedItem2(String s2){ this.s2 = s2; } public List<SelectOption> getItems(){ List<SelectOption> options = new list<SelectOption>(); String mins = '30'; for (Integer i = 0; i < 48; i++) { mins = (mins == '30') ? '00' : '30'; Integer hrs = ((i*30) / 60); String hr = (string.valueOf(hrs).length() == 1) ? '0' + string.valueOf(hrs) : string.valueOf(hrs); String key = hr + ':' + mins; options.add(new SelectOption(key, key)); } return options; }
<apex:repeat value="{!events}" var="itr"> <br/><br/> <table> <tr> <td><apex:inputfield value="{!itr.Subject}" id="subject"/></td><td> <apex:inputfield value="{!itr.IsAllDayEvent}" id="day"/></td><td> <apex:inputfield value="{!itr.StartDateTime}" id="start"/></td><td> <apex:selectlist value="{!SelectedItem}" size="1"> <apex:selectOptions value="{!Items}"/> </apex:selectlist></td><td> <apex:inputfield value="{!itr.EndDateTime}" id="end"/></td><td> <apex:selectlist value="{!SelectedItem2}" size="1"> <apex:selectOptions value="{!Items}"/> </apex:selectlist></td><td> <apex:inputfield value="{!itr.Status__c}" id="status" /></td><td> <apex:inputField value="{!itr.Type__c}" id="type"/></td><td> <apex:inputField value="{!itr.Consultancy_Duration__c}" id="duration"/></td><td> <apex:inputField value="{!itr.Project_Phase__c}" id="phase"/></td><td> <apex:inputField value="{!itr.Location}" id="location"/></td><td> <apex:inputField value="{!itr.Description}" id="description"/></td> </tr> </table> </apex:repeat> <br/><br/> <p align="center"><apex:commandButton action="{!save}" value=" Save " /></p>
hey have u got the solution to the problem as i am also facing the same issue.?
Please help if u have solution.
Unfortunately, I could not find a solution, given up on using repeat tag. And 10 times to repeat the all inputfields without repeat tag. Maybe you use to <apex:variable> tag for its work.
i want to repeat the select list 'n' number of times.will <apex:variable> tag work?
I'm not sure becuase I haven't tried this, I said maybe you can try.
following codes are not the solution that you're looking for but maybe give an idea you.
No this code isnt useful for me.
As i don want input field associated with my code.
I want to create a selectlist listbox ' n' times where 'n' is the value from controlller.
So i had used selectlist within repeat tag and achieved it.
but now i am not able to get the value for selectlist which i select.
IF you any other solution please help.
THis link is similar case:
http://salesforce.stackexchange.com/questions/11965/apexselectlist-value-not-getting-set-in-controller/12212#
but i am not understanding what is done in it.
THanks.