function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alena Semenova 14Alena Semenova 14 

Can you please tell me how to choose a particular field of the lookup which have questions? in each lookup there are questions (it's test app). the user selects a particular test and needs questions of the selected test. help :(

Clicking on a button and moving to a new page with questions:

public PageReference runTest () {
        insert newSession; 
        PageReference ref = new PageReference ('/apex/LaunchTests');
        return ref;
        
    }


Controller:

public class LaunchTestsController {
    public List <Test_item__c> newItem { get; set;} 
    
    public LaunchTestsController () {
        
        string str = 'SELECT Id, Question__c, Response__c, Response1__c, Responce2__c, Answer__c FROM Test_item__c';
        this.newItem = Database.query(str);
    }
    
    
}
VF Page:
<apex:page controller="LaunchTestsController" >
    
    <apex:form >
    <apex:pageBlock title="Questions">
        <apex:pageBlockTable value="{!newItem}" var="item">
        <apex:column value="{!item.Question__c}"/>
           
        </apex:pageBlockTable>

        </apex:pageBlock>
        
    </apex:form>
</apex:page>

 
Waqar Hussain SFWaqar Hussain SF
Can you be more specific regarding what you are looking for?
Alena Semenova 14Alena Semenova 14
I want select one item and displayed  only information about one, but I have all 3 at once

User-added image
Waqar Hussain SFWaqar Hussain SF
So you want to show selected lookup record information on your VF page, Correct?
Waqar Hussain SFWaqar Hussain SF
See the following blog, I think this is what you are looking for. 

Basically you will have to user apex:ActionSupport on your input lookup field to fetch the information of Selected lookup record.
See example
http://bobbuzzard.blogspot.com/2011/11/retrieve-related-object-fields.html