10
votes
Apex:selectList value - How to set it initially?
You need to set the value that the select list is bound to..
public class mytest{
public string selectedValue {get;set;}
public class mytest(){
selectedValue = 'Sister';
}
public ...
10
votes
Accepted
Is this possible to position label for lightning:select on the left?
By placing the <lightning:select> in a horizontal form, it will transform the labels to the left.
<div class="slds-form_horizontal">
<lightning:select name="SelectOrNot" value="{!v....
9
votes
Accepted
How do I get label of the selected item from a lightning:select drop down list?
Strictly speaking, you can't get the label, because the child elements are hidden away from you ("Locker Service"). If you just want the name of the contact, you can do something like this:
var ...
8
votes
Accepted
Adding/defaulting a null value to a selectlist on a Visualforce page
I usually just do this.
Class:
public List <SelectOption> getisNDA() {
List<SelectOption> options3 = new List<SelectOption>{
new SelectOption('','-Select-')
};
...
6
votes
Accepted
html-placeholder in apex:selectList: is it real? Or is there an alternative?
HTML's select does not have a placeholder attribute. Instead, you can just specify a different label and value on the first entry:
options.add(new SelectOption('','-- select --'));
5
votes
Accepted
Render an InputText based on Selected Option
Place <apex:inputText> in separate outputPanel and try to rerender that panel on actionSupport call.
Also added at <apex:ouputText> to confirm the value is correctly be displayed
<...
5
votes
Adding/defaulting a null value to a selectlist on a Visualforce page
Before starting your for loop add following line of code.
options3.add(new SelectOption(' ', ' '));
5
votes
Accepted
How to populate lightning:select with picklist field values?
The basic method today is to get the values from the server, then render the values with $A.createComponents.
doInit: function(component, event, helper) {
var action = component.get("c.init");
...
5
votes
Is this possible to position label for lightning:select on the left?
Wrap it in a div and apply the "slds-form_horizontal" class like so:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,lightning:isUrlAddressable">
<...
4
votes
Id none must be 15 characters
The clue to your problem is in the error message:
Id none must be 15 characters
so it looks like the error occurs when the first entry:
options.add(new SelectOption('None','----Select----'));
is ...
4
votes
Accepted
Invalid selectOptions found. Use SelectOption type in Apex (why?)
apex:selectOptions is for adding a list of SelectOption objects from Apex. If you want to define the options in visualforce, use apex:selectOption:
<apex:pageBlockTable value="{!RowList}" var="c"&...
4
votes
Accepted
SelectList in PageBlock Table is not working as expected
The issue you are having is here:
<apex:pageBlockTable value="{!lineItems}" var="items" >
...
<apex:column headerValue="Select Commodity">
...
3
votes
SelectList's -Setting value with an IF condition does not work
SelectList value attribute needs to bind to a controller setter property. It represents the value chosen by the user from the picklist.
OutputText value is merely displaying text, the source can be ...
3
votes
Accepted
Disable selectList after selection is made
You can try one thing. Check if recordType not null then then hide this field
<apex:outputText value="{!recordType}" rendered="{!recordType != null || recordType != ''}"/ >
<apex:...
3
votes
Accepted
Creating selectList/selectOptions from SOQL
Yes, you'll want to make a list of SelectOption to bind to.
public SelectOption[] contactOptions { get; set; }
public Id selectedContactId { get; set; }
public void searchContacts() {
...
3
votes
Accepted
Dynamic Select Option in Remote Objects Visualforce. This page is not record-specific
You can use remoting for this purpose. Here's a generic page that loads the record types for Account (replace with your desired object):
<apex:page >
<apex:remoteObjects jsNamespace="...
3
votes
How to populate lightning:select with picklist field values?
Here is how I populate lightning:select with picklist values:
1) create a server-side method that returns list of all picklist values available
2) call this method when lightning component is ...
2
votes
Id none must be 15 characters
If you check documentation about SelectOption class(https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_pages_selectoption.htm), you can see that first parameter in constructor is ...
2
votes
Accessing static helper method in Visualforce page
You need to expose a property on an extension. Something like:
public with sharing class MyExtension
{
public List<SelectOption> options { get; private set; }
public MyExtension(...
2
votes
Accepted
Accessing static helper method in Visualforce page
You have to turn the class into an extension or controller, or you can reference it via a method in your main controller.
As Controller
Page
<apex:page controller="HelperClass" >
Controller
...
2
votes
Accepted
How to make an inputField required based on options from SelectList?
Instead of calling into saveDocuSignRecord you would build a new method that would control any of the validation that would need to be done and then it would throw an error..
VF PAGE
<apex:...
2
votes
I wanna have a <apex:selectList that automatically fetches select options from an object's field
if Country__c is a picklist field the you can simply use
<apex:inputField value="{!Location__c.Country__c}" />
This will generate picklist for you
2
votes
Accepted
Invalid selectOptions found. Use SelectOption type in Apex error
Posted code in the question seems to be ok but this error can be occurred if you have any variable with the same name i.e. vector in your controller (with get;).
In this case SelectOptions tag in the ...
2
votes
Accepted
SelectOption Method only working before clicking commandButton (quiscksave)
I strongly suspect the problem is because you've declared the following as final:
private final Link_Generator__c linkgen;
Even when using an instance method as you do when using the this keyword, ...
2
votes
Accepted
Selectlist options change not reflecting in apex class
An Apex controller constructor only runs when the page is first opened. When an apex:actionSupport or apex:commandButton runs the controller, the controller instance is re-created from the view state ...
2
votes
Accepted
selected account(parent) name from select option,show its related child(contact obj) on vfpage
There may have multiple contact related to selected Account. You need to iterate contact list to display all the related contacts.There is an error in your query, it should be AccountId insted of id.
...
2
votes
Accepted
Pageblocktable with dependent selectlist - wrapper rerender issues
You are correct, the problem is with duplicated selectlist's id's. You have to keep the selected value unique for each selectlist, or else they will all overwrite into the same variable and you won't ...
2
votes
Help with a Test code on specific Method
Your test does not truly test anything, because every single one of your assertions is just a null check or a tautology (showing that a == a). Since your code isn't supposed to return null, all this ...
2
votes
Accepted
How to save picklist value selected by user on visualforce page
You're setting the "value" to nothing in all the options. You need to specify a value:
Alcoholinv.add(new selectOption('', '--None--'));
Alcoholinv.add(new selectoption('Yes', 'Yes'));
...
2
votes
Accepted
Getting "Nesting of semi join sub-selects is not supported" when submitting query
You can't nest more than once, as the error says, but in this case, you can use the relationship field instead:
SELECT Id, EODBID__c
from Account
where Id in
(Select AccountId
from ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
selectlist × 143visualforce × 101
apex × 70
selectoption × 39
rerender × 11
controller × 10
picklist × 10
actionsupport × 6
multi-select × 5
javascript × 4
html × 4
controller-extension × 4
pageblocktable × 4
onchange × 4
lightning-aura-components × 3
soql × 3
visualforce-component × 3
list × 3
dynamic-visualforce × 3
inputfield × 3
rendered × 3
lightning × 2
aura × 2
css × 2
lightning-design-system × 2