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 ...
Eric's user avatar
  • 54k
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....
sfdcfox's user avatar
  • 481k
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 ...
sfdcfox's user avatar
  • 481k
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-') }; ...
Andrew L.'s user avatar
  • 837
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 --'));
sfdcfox's user avatar
  • 481k
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 <...
Santanu Boral's user avatar
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(' ', ' '));
Ishwar Mete's user avatar
  • 1,492
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"); ...
sfdcfox's user avatar
  • 481k
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"> <...
Aaron P.'s user avatar
  • 1,667
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 ...
Keith C's user avatar
  • 135k
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"&...
IllusiveBrian's user avatar
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"> ...
cropredy's user avatar
  • 69.9k
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 ...
cropredy's user avatar
  • 69.9k
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:...
Tushar Sharma's user avatar
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() { ...
sfdcfox's user avatar
  • 481k
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="...
sfdcfox's user avatar
  • 481k
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 ...
Alexey Yezhkov's user avatar
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 ...
kurunve's user avatar
  • 4,279
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(...
Adrian Larson's user avatar
  • 149k
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 ...
sfdcfox's user avatar
  • 481k
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:...
EricSSH's user avatar
  • 4,324
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
Ratan Paul's user avatar
  • 22.5k
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 ...
highfive's user avatar
  • 6,231
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, ...
crmprogdev's user avatar
  • 40.9k
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 ...
Keith C's user avatar
  • 135k
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. ...
Ajay Prakash Dubey's user avatar
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 ...
Saroj Bera's user avatar
  • 14.6k
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 ...
David Reed's user avatar
  • 92.1k
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')); ...
sfdcfox's user avatar
  • 481k
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 ...
sfdcfox's user avatar
  • 481k

Only top scored, non community-wiki answers of a minimum length are eligible