+ Start a Discussion
sales@myvarmasales@myvarma 

windowpopup to update record data (help me)

<apex:page controller="OppNameSearchController" >
    <apex:form id="form">
        <apex:pageBlock>
         
              <apex:pageBlockSection title="Search Filter" >
                Opportunity Name: <apex:inputText value="{!Name}"/>
                <apex:commandButton value="Search" action="{!method}" />
            </apex:pageBlockSection>
            <apex:pageMessages ></apex:pageMessages>
            
        </apex:pageBlock>
        <apex:pageblock>
<apex:pageBlockTable value="{!Opp}" var="row" rendered="{!show}">
<apex:column >
<apex:outputLink title="" value="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}" style="font-weight:bold">Edit</apex:outputLink>&nbsp;|&nbsp;
</apex:column>

                                                                                                  
               
    <script type="text/javascript">
    function popupwindow()
    {
        var newwindow = window.open('/apex/OppNameSearchController','newwindow','height=400','width=1000','left=100','top=100'); 
       
    }
    </script>     
    <apex:commandButton action="{!edit}" value="edit" onclick="popupwindow()"/>   
            <apex:column value="{!row.Name}"/>
            <apex:column value="{!row.Amount}"/>
            </apex:pageBlockTable>
        </apex:pageblock>
           
</apex:form>
</apex:page>
 
public class OppNameSearchController {
    public list<Opportunity>Opp{set;get;}
    public string Name{set;get;}
    public Decimal amount{set;get;}
    
    public boolean show{set;get;}
    
    public OppNameSearchController()
    {
        Opp = new List<Opportunity>();
        Opp= [select id, Name, Amount from Opportunity];
    }
    public void method()
    {
      
        integer OppCount=[select count() from Opportunity where Name LIKE: Name+'%'];
        if(OppCount != 0)
        {
            Opp = [select  name, Amount from Opportunity where Name LIKE: Name+'%' ];
            show = true;
        }
        else
        {
            ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'There are no Opportunities with the Name -'+Name);
            ApexPages.addMessage(myMsg);
            show = false;
        }
    }
    
    public void save()
    {
        
        update Opp;
     
    }
     public void edit()
 {
     String oppid= ApexPages.currentPage().getParameters().get('oppid'); 
 }
 
     public void clear(){  	
  
        Opp=NULL;
                  
   }  
}

 
Sagar_SFDCSagar_SFDC
Hi sales@myvarma,

What is the issue in this??

Thanks 
Sagar Sindhi