You need to sign in to do that
Don't have an account?
harsha vardhan vasa 9
i need save functionality for the below code
save button and when clicked that record with updated value should saved against that record.
when user updating the lookup on VF page it should get saved to record.
need save functionality.
Below code:
VF page:
<apex:page Controller="CustAccount" >
<apex:form >
<apex:pageBlock >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection>
<apex:inputText value="{!searchstring}" label=" enter username here" />
<apex:commandButton value="Search" action="{!search}" reRender="accpg,showmsg" />
</apex:pageBlockSection>
<apex:pageBlockTable value="{!acc}" var="a" id="accpg" rendered="{!acc.size != 0}">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.stagename}"/>
<apex:column value="{!a.amount}" />
<apex:column title="UserName" headerValue="Username">
<apex:inputfield value="{!a.UserName__c}" />
</apex:column>
<apex:column>
<apex:inputfield value="{!a.ownerid}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class CustAccount {
public string searchstring {get;set;}
public List<opportunity> acc {get;set;}
public custaccount() {
}
public void search(){
if(searchstring !=null || searchstring!= ''){
system.debug(searchstring );
/* acc= [SELECT Name, StageName, CloseDate, Amount, Owner.Name, Owner.Username,username__C
FROM Opportunity where Owner.username like : ('%' +searchstring + '%')]; */
acc= [SELECT Name, StageName, CloseDate, Amount, Owner.Name, Owner.Username,username__c
FROM Opportunity where Owner.username like : ('%' +searchstring + '%')];
system.debug('value os acc is '+acc);
system.debug(acc.size());
if(acc.size() ==0){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'No matching opportunities found for the entered value'));
}
}
}
}
pls help me guys.
Regards,
harsha
when user updating the lookup on VF page it should get saved to record.
need save functionality.
Below code:
VF page:
<apex:page Controller="CustAccount" >
<apex:form >
<apex:pageBlock >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection>
<apex:inputText value="{!searchstring}" label=" enter username here" />
<apex:commandButton value="Search" action="{!search}" reRender="accpg,showmsg" />
</apex:pageBlockSection>
<apex:pageBlockTable value="{!acc}" var="a" id="accpg" rendered="{!acc.size != 0}">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.stagename}"/>
<apex:column value="{!a.amount}" />
<apex:column title="UserName" headerValue="Username">
<apex:inputfield value="{!a.UserName__c}" />
</apex:column>
<apex:column>
<apex:inputfield value="{!a.ownerid}" />
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class CustAccount {
public string searchstring {get;set;}
public List<opportunity> acc {get;set;}
public custaccount() {
}
public void search(){
if(searchstring !=null || searchstring!= ''){
system.debug(searchstring );
/* acc= [SELECT Name, StageName, CloseDate, Amount, Owner.Name, Owner.Username,username__C
FROM Opportunity where Owner.username like : ('%' +searchstring + '%')]; */
acc= [SELECT Name, StageName, CloseDate, Amount, Owner.Name, Owner.Username,username__c
FROM Opportunity where Owner.username like : ('%' +searchstring + '%')];
system.debug('value os acc is '+acc);
system.debug(acc.size());
if(acc.size() ==0){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,'No matching opportunities found for the entered value'));
}
}
}
}
pls help me guys.
Regards,
harsha
Please go through the following code as it may be helpful in solving your problem:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha.