You need to sign in to do that
Don't have an account?
Surya Kallakuri
visual force:
Code:
<apex:page controller="searchcls" >
<apex:form >
<apex:pageBlock >
<apex:inputText value="{!stringval}"/>
<apex:commandButton value="search" action="{!search}"/>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageblockTable value="{!acctlst}" var="a">
<apex:column headerValue="Account Name" value="{!a.name}"/>
<apex:column headerValue="Fax" value="{!a.Fax}"/>
<apex:column headerValue="Phone" value="{!a.phone}"/>
<apex:column headerValue="Billingcountry" value="{!a.billingcountry}"/>
<apex:column headerValue="Billingstate" value="{!a.billingstate}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex controller:
public class searchcls {
public List<Account> acctlst { get; set; }
public String stringval { get; set; }
public PageReference search() {
acctlst = (List<Account>)[FIND: stringval RETURNING Account(name, fax, phone, billingstate, billingcountry)][0];
if(acctlst =! null) return 'acctlst';
if(acctlst == null) return 'unknown';
}
}
My code is not working..I tried the task like..If I search for an account details.... if the account exists it should display account details or else it should throw me a error message as account not exists
visual force:
Code:
<apex:page controller="searchcls" >
<apex:form >
<apex:pageBlock >
<apex:inputText value="{!stringval}"/>
<apex:commandButton value="search" action="{!search}"/>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageblockTable value="{!acctlst}" var="a">
<apex:column headerValue="Account Name" value="{!a.name}"/>
<apex:column headerValue="Fax" value="{!a.Fax}"/>
<apex:column headerValue="Phone" value="{!a.phone}"/>
<apex:column headerValue="Billingcountry" value="{!a.billingcountry}"/>
<apex:column headerValue="Billingstate" value="{!a.billingstate}"/>
</apex:pageblockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex controller:
public class searchcls {
public List<Account> acctlst { get; set; }
public String stringval { get; set; }
public PageReference search() {
acctlst = (List<Account>)[FIND: stringval RETURNING Account(name, fax, phone, billingstate, billingcountry)][0];
if(acctlst =! null) return 'acctlst';
if(acctlst == null) return 'unknown';
}
}
Visualforce:
Apex Controller:
Really hope this helps you out.
Happy Holidays!
All Answers
Visualforce:
Apex Controller:
Really hope this helps you out.
Happy Holidays!
Thanks for the help.
Merry Christmas & Happy Holidays