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
d.tejdeep@nicomatic.ind.tejdeep@nicomatic.in 

how to show the record list querying the user input

controller:

public with sharing class textInputsCon {
     public String inputText1{get;set;} // input text1 value  from vf
     public String inputText2{get;set;} // input text2 value  from vf  
     public showlist(){
    list<Quote__c>  quo= [select Quote_Number_New__c from quote__c where Quote_Number_New__c=:inputtext1 ];
      return list<Quote__C> quo.getrecords();
     }
     }

vfpage:

<apex:page showHeader="false" sidebar="False" controller="textInputsCon">
    <apex:form >
       Input Text1 <apex:inputText value="{!inputText1}"/>
       Input Text2 <apex:inputText value="{!inputText2}"/>
        <apex:commandButton value="list" action="{!showlist}"/>
         <apex:pageBlock >
            <apex:pageBlockTable value="{!Quote__c}" var="q">
                <apex:column value="{!q.Quote_new_number__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
    </apex:page>


Error: textInputsCon Compile Error: unexpected token: 'list' at line 6 column 13


i want to query the user input and get results in the same page.how can i do that can any one correct this error
Best Answer chosen by d.tejdeep@nicomatic.in
ShaTShaT
Hi,

Use this code.

public with sharing class textInputsCon {
     public String inputText1{get;set;} // input text1 value  from vf
     public String inputText2{get;set;} // input text2 value  from vf 
    public  list<Quote__c>  quo{get;set;}
     public showlist(){
       quo= [select Quote_Number_New__c from quote__c where Quote_Number_New__c=:inputtext1 ];
      
     }
     }


<apex:page showHeader="false" sidebar="False" controller="textInputsCon">
    <apex:form >
       Input Text1 <apex:inputText value="{!inputText1}"/>
       Input Text2 <apex:inputText value="{!inputText2}"/>
        <apex:commandButton value="show " action="{!showlist}" rerender=listPanel"/>
         <apex:pageBlock  id="listPanel">
        <apex:pageBlockTable value="{!quo}" var="q" >
                <apex:column value="{!q.Quote_new_number__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
    </apex:page>

Hope this helps you.

Thanks
ShaT

All Answers

ShaTShaT
Hi,

Use this code.

public with sharing class textInputsCon {
     public String inputText1{get;set;} // input text1 value  from vf
     public String inputText2{get;set;} // input text2 value  from vf 
    public  list<Quote__c>  quo{get;set;}
     public showlist(){
       quo= [select Quote_Number_New__c from quote__c where Quote_Number_New__c=:inputtext1 ];
      
     }
     }


<apex:page showHeader="false" sidebar="False" controller="textInputsCon">
    <apex:form >
       Input Text1 <apex:inputText value="{!inputText1}"/>
       Input Text2 <apex:inputText value="{!inputText2}"/>
        <apex:commandButton value="show " action="{!showlist}" rerender=listPanel"/>
         <apex:pageBlock  id="listPanel">
        <apex:pageBlockTable value="{!quo}" var="q" >
                <apex:column value="{!q.Quote_new_number__c}"/>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
    </apex:page>

Hope this helps you.

Thanks
ShaT
This was selected as the best answer
d.tejdeep@nicomatic.ind.tejdeep@nicomatic.in
hi

I have a selectlist of equal ,not equal to , less than ....how can i change logic in this query according to user input


d.tejdeep@nicomatic.ind.tejdeep@nicomatic.in
quo= [select Quote_Number_New__c from quote__c where Quote_Number_New__c=:inputtext1 ];