You need to sign in to do that
Don't have an account?
An internal server error has occurred : Urgent Help Needed
Hi All,
Long time no see.. :smileywink:
This time im back with one more query of mine which is holding me back. :smileysad:
I have been trying to host a modal window designed using CSS, and i have written a Search query in the code. When i click the Search button for the first time it doesnt throw and error, once i try to resue the search functionality, it throws the Error : An internal server error has occurred :smileysad:
My Code is as below :
<!--Start Div tag for company--> <div id="modalPageCompany"> <div class="modalBackground"> </div> <!--end of modal background--> <div class="modalContainer"> <div class="modal"> <div class="modalTop"><div align="left"><b>Company Search</b></div><apex:commandbutton action="{!clearcompanylist}" value="Cancel" oncomplete="hideModal('modalPageCompany')"/> </div> <div class="modalBody"> <apex:pageBlock > <table> <tr><td width="20%" align="right"><apex:outputlabel value="Name: "/></td><td width="30%"><apex:inputtext value="{!CompanyNameSearch}" id="CompanyNameSearch"/></td></tr> <tr><td colspan="2" align="center" style="width:100%;"><apex:commandButton value="Search" action="{!searchCompany}" reRender="clearcompanybutton,companysearchdisplay,CompanyAddButton,NoComprecord,selectcompanytext"/> <apex:commandButton id="clearcompanybutton" value="Clear" action="{! clearcompanylist}" reRender="clearcompanybutton,companysearchdisplay,CompanyNameSearch,NoComprecord,selectcompanytext" disabled="{! companyclearbuttondisplay}"/> </td></tr> </table> </apex:pageblock> <apex:pageblock id="companysearchdisplay" > <apex:commandLink id="selectcompanytext" action="{!selectAllCompany}" value="{! SelectallCompany}" rerender="companysearchdisplay,companysearchtable,selectcompanytext" rendered="{! companyListDisplay}"/> <center> <apex:commandButton id="CompanyAddButton" value="Add" action="{!addcompanies}" onclick="IsChecked3('modalPageCompany')" rerender="companiesblock,addedcompaniesdatatable,companycountlabelid" /></center> <center> <apex:outputlabel id="NoComprecord" value="No Records Found" rendered="{! Nocomprecfound}"/> </center> <center> <apex:commandLink action="{!prevCompanySearch}" value="Previous" rerender="companysearchdisplay" rendered="{!prevCompSearchListCheck}"/> <apex:commandLink action="{!nextCompanySearch}" value="Next" rerender="companysearchdisplay" rendered="{!nextCompSearchListCheck}"/> </center> <apex:pageBlocktable id="companysearchtable" value="{!companySearchListdisplay}" var="CSL" rendered="{!companyListDisplay}"> <apex:column headervalue="Add"><apex:inputcheckbox value="{!CSL.addCompany}" onclick="disp3(this)"> <apex:actionSupport event="onclick" action="{!enablecompadd}" reRender="companysearchdisplay"/> </apex:inputcheckbox></apex:column> <apex:column headerValue="Company Name" value="{!CSL.CompanyName}"/> </apex:pageBlocktable> <center> <apex:commandLink action="{!prevCompanySearch}" value="Previous" rerender="companysearchdisplay" rendered="{!prevCompSearchListCheck}"/> <apex:commandLink action="{!nextCompanySearch}" value="Next" rerender="companysearchdisplay" rendered="{!nextCompSearchListCheck}"/> </center> <apex:inputhidden id="hid3"/> </apex:pageBlock> </div> <!--end of modal body-->
</div><!--end of modal--> </div><!--end of modal container--> </div> <!-- end of modalcompany div--> <!--End Div tag for company-->
//procedures for companies public void clearcompanylist() { companyaddbuttondisplay =true; companyclearbuttondisplay =true; companyListDisplay =false; CompanyNameSearch =''; Nocomprecfound =false; if (companySearchList.size() >0) companySearchList.clear(); prevCompSearchListCheck= false; nextCompSearchListCheck= false; SelectallCompany=''; } public void searchCompany() { companySearchListDisplay = new List<searchCompanies>(); companySearchList = new list<searchCompanies>(); companySearchListDisplay.clear(); companySearchList.clear(); Nocomprecfound=false; // to clear the search list before every search if (companySearchListdisplay.size() >0) // to be deleted for pagenation companySearchListdisplay.clear(); if (companySearchList.size() >0) companySearchList.clear(); if(CompanyNameSearch!=null) CompanyNameSearch ='\'%'+CompanyNameSearch+'%\''; else CompanyNameSearch ='\'%%\''; try { String querystring = 'select id, name from account where Inactive__c=false and name like '+CompanyNameSearch+' limit 100' ; String excludedid=''; if (compsearhexcludeidmap.size() >0) { for (id compid: compsearhexcludeidmap.keyset()) excludedid= excludedid+ '\''+ compsearhexcludeidmap.get(compid).companyid+ '\''+','; excludedid =excludedid.substring(0,excludedid.length()-1); querystring= querystring + ' and id not in ('+ excludedid + ')'; } system.debug('the string is ' +querystring ); List <account> company = database.query(querystring); companyclearbuttondisplay =false; if (company.size()>0) { system.debug(company); searchCompanies searchcomp; for (account a: company) { searchcomp = new searchCompanies(); searchcomp.companyId = a.Id + ''; searchcomp.addcompany = false; searchcomp.companyName =a.name; searchcomp.initiallypresent =false; companySearchList.add(searchcomp); //companySearchListdisplay.add(searchcomp);// to be changed when pagenation implemented } companyListDisplay =true; SelectallCompany='Select All'; nextCompSearchList =0; // to be changed when pagenation implemented nextCompanySearch();// to be changed when pagenation implemented } else Nocomprecfound=true;//the search returned nothing. } catch(SearchException se) { CompanyNameSearch ='Encountered exception. please correct it again thats it'; system.debug('encountered error. Error is: '+se); ApexPages.addMessages(se); } } public void addcompanies() { // addedcompanyList.clear(); for(searchCompanies sc :companySearchList) if(sc.addCompany==True) { addedcompanyList.add(sc); compsearhexcludeidmap.put(sc.companyid,sc); } system.debug('the list of companies to be added '+addedcompanyList); addedcompanyblockdisplay =(addedcompanyList.size() >0)? true:false; companycount = addedcompanyList.size(); nextCompAddedList =0; nextAddedCompany(); } public void removeCompany() { system.debug('remove id = '+ deletecompanyId); if (compsearhexcludeidmap.get(deletecompanyId)!=null) { if(compsearhexcludeidmap.get(deletecompanyId).initiallypresent ==true) deletecompfromgroupobj.add(compsearhexcludeidmap.get(deletecompanyId).recordId); compsearhexcludeidmap.remove(deletecompanyId); addedcompanyList.clear(); for(id compid:compsearhexcludeidmap.keyset()) addedcompanyList.add(compsearhexcludeidmap.get(compid)); companycount = addedcompanyList.size(); addedcompanyblockdisplay =(addedcompanyList.size() >0)? true:false; nextCompAddedList =0; nextAddedCompany(); } system.debug('the list of companies to be deleted are '+deletecompfromgroupobj); system.debug('to be shown are '+addedcompanyList); } public void selectAllCompany() { if(selectAllCompanyCheck==True) { selectAllCompanyCheck=false; SelectallCompany ='Select All'; companyaddbuttondisplay =true; } else { selectAllCompanyCheck=True; SelectallCompany ='Deselect All'; companyaddbuttondisplay =false; } for(Integer loopCounter=0;loopCounter<companySearchListdisplay.size();loopCounter++) companySearchListdisplay[loopCounter].addcompany=selectAllCompanyCheck; } public void prevCompanySearch() { companySearchListdisplay.clear(); Integer limit1 = 0; nextCompSearchListCheck=True; if((nextCompSearchList - (CompSearchCount+CompSearchCount)) > 0) { limit1 = nextCompSearchList -CompSearchCount; prevCompSearchListCheck= True; } else { limit1 = nextCompSearchList -CompSearchCount ; prevCompSearchListCheck= false; } for(Integer i=nextCompSearchList - (CompSearchCount+CompSearchCount); i<limit1; i++) companySearchListdisplay.add(CompanySearchList[i]); nextCompSearchList -=CompSearchCount; enablecompadd(); } public void nextCompanySearch() { companySearchListdisplay.clear(); integer limit1=0; if(nextCompSearchList +CompSearchCount < CompanySearchList.size()) { limit1 = nextCompSearchList +CompSearchCount ; nextCompSearchListCheck=True; } else { limit1 = CompanySearchList.size(); nextCompSearchListCheck= false; } if(nextCompSearchList >0) prevCompSearchListCheck=True; else prevCompSearchListCheck=False; for(Integer i=nextCompSearchList; i<limit1; i++) companySearchListdisplay.add(CompanySearchList[i]); nextCompSearchList +=CompSearchCount; enablecompadd(); } public void prevAddedCompany() { addedcompanyListdisplay.clear(); Integer limit1 = 0; nextCompAddedListCheck=True; if((nextCompAddedList- (CompAddedCount+CompAddedCount)) > 0) { limit1 = nextCompAddedList -CompAddedCount; prevCompaddedListCheck= True; } else { limit1 = nextCompAddedList -CompAddedCount; prevCompaddedListCheck= false; } for(Integer i=nextCompAddedList- (CompAddedCount+CompAddedCount); i<limit1; i++) addedcompanyListdisplay.add(addedCompanyList[i]); nextCompAddedList -=CompAddedCount; } public void nextAddedCompany() { addedcompanyListdisplay.clear(); integer limit1=0; if(nextCompAddedList +CompAddedCount< addedCompanyList.size()) { limit1 = nextCompAddedList +CompAddedCount; nextCompAddedListCheck=True; } else { limit1 = addedCompanyList.size(); nextCompAddedListCheck= false; } if(nextCompAddedList >0) prevCompaddedListCheck=True; else prevCompaddedListCheck=False; for(Integer i=nextCompAddedList ; i<limit1; i++) addedcompanyListdisplay.add(addedCompanyList[i]); nextCompAddedList +=CompAddedCount; } public void removeallCompanies() { for(id compid:compsearhexcludeidmap.keyset()) if(compsearhexcludeidmap.get(compid).initiallypresent ==true) deletecompfromgroupobj.add(compsearhexcludeidmap.get(compid).recordId); compsearhexcludeidmap.clear(); addedcompanyList.clear(); companycount = addedcompanyList.size(); addedcompanyblockdisplay =(addedcompanyList.size() >0)? true:false; nextCompAddedList =0; nextAddedCompany(); } public void enablecompadd() { integer i=0; for(Integer loopCounter=0;loopCounter<companySearchList.size();loopCounter++) if (companySearchList[loopCounter].addcompany==true) { i=1; break; } if (i==1) companyaddbuttondisplay =false; else companyaddbuttondisplay =true; }
The Class is as above, the code marked in Red is the code which throws the error.
Please help me with the same. :smileysad:
- TIA
Sushupsi.
<style> #modalPageContact { display: none; position: absolute; width: 100%; height: 80%; top: 0px; left: 0px; } #modalPageEmp { display: none; position: absolute; width: 100%; height: 80%; top: 0px; left: 0px; } #modalPageCompany { display: none; position: absolute; width: 100%; height: 80%; top: 0px; left: 0px; } .modalBackground { filter: Alpha(Opacity=40); -moz-opacity:0.4; opacity: 0.4; width: 100%; height: 100%; background-color: #999999; position: absolute; z-index: 500; top: 0px; left: 0px; } .modalContainer { position: relative; width: 300px; left: 50%; top: 50%; z-index: 750; } .modal { background-color: white; border: solid 2px #BE5E5E; position: relative; top: -150px; left: -150px; z-index: 1000; width: 600px; height: 400px; padding: 0px; } .modalTop { width: 594px; background-color: #BE5E5E; padding: 4px; color: #ffffff; text-align: right; } .modalTop a, .modalTop a:visited { color: #ffffff; } .modalBody { padding: 10px; } </style> <!--Start for companies tab--> <apex:tab label="Companies" name="companies" style="font-weight:bold;"> <table width="100%"> <tr><td><apex:outputLabel style="font-weight:bold;" value="Number of Companies: "/><apex:outputlabel id="companycountlabelid" style="font-weight:bold;color:blue;" value="{!companycount}"/></td></tr> </table><br/> <apex:pageBlock title="Companies" id="companiesblock" > <center> <apex:commandButton value="Add" action="{!clearcompanylist}" onclick="revealModal ('modalPageCompany')" reRender="companysearchdisplay,CompanyNameSearch"/> <apex:commandButton value="Remove All" reRender="companycountlabelid,companiesblock,addedcompaniesdatatable" action="{!removeallCompanies}"/> </center>
<apex:pageBlocktable id="addedcompaniesdatatable" value="{! addedcompanyList}" var="ACL" rendered="{!addedcompanyblockdisplay}"> <apex:column headervalue="Action" width="5%"><apex:commandLink value="Remove" reRender="companiesblock,addedcompaniesdatatable,companycountlabelid" action="{!removeCompany}"> <apex:param name="testparam" assignTo="{!deleteCompanyId}" value="{! ACL.companyId}"/></apex:commandlink></apex:column> <apex:column headerValue="Company Name" value="{!ACL.CompanyName}"/> </apex:pageBlocktable> <apex:inputhidden id="hid3"/> </apex:pageBlock> </apex:tab> <!--End for companies tab-->
can you paste your debug log ? go to <your name> > System Log before running the page.