You need to sign in to do that
Don't have an account?
Rama Moorthy
getting error from second time while using re render
if i select the values from the picklist , the whole page gets refreshed and the some values are not retained (its gone). Then i rerender only the block which contains the pikclist . Not more than one time it is working. if i change the selection in pikclist for the second time i am getting the following error
"apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute. "
Please provide me a solution not to refresh the whole page on change in picklist. My code
"apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute. "
Please provide me a solution not to refresh the whole page on change in picklist. My code
VF Page : <apex:page standardController="Case" extensions="RForce_ES_Web2Case_Extn" showHeader="false" sidebar="false" standardStylesheets="False" id="pge"> <head> <link rel="stylesheet" href="{!URLFOR($Resource.web2caseResources,'web2case/css/validationEngine.jquery_Dacia.css')}" type="text/css" media="screen" title="no title" charset="utf-8" /> <!---MaskPlugin----> <apex:includeScript value="{!$Resource.MaskFuntion1}"/> <apex:includeScript value="{!$Resource.MaskFuntion}"/> <!---ValidationPlugin----> <script src="{!URLFOR($Resource.web2caseResources,'web2case/js/jquery_min.js')}" type="text/javascript" charset="UTF-8"></script> <script src="{!URLFOR($Resource.web2caseResources,'web2case/js/jquery.validationEngine-es.js')}" type="text/javascript"></script> <script src="{!URLFOR($Resource.web2caseResources,'web2case/js/jquery.validationEngine.js')}" type="text/javascript"></script> <script src="{!URLFOR($Resource.web2caseResources,'web2case/js/Rforce_NordicWebToCase.js')}" type="text/javascript"></script> <style> form{ width:540px; background-color:#EDEDED; font-family: Arial,"Trebuchet ms",Verdana,sans-serif; font-size: 11px; font-family: Arial,"Trebuchet ms",Verdana,sans-serif; padding: 7px 7px 0px 7px; } div #button{ float: right; margin-right: 3px; } input.text { border: 1px solid #DADCDE; color: #484848; font-size: 12px; height: 16px; padding-top: 4px; } p{ font-family: Arial,"Trebuchet ms",Verdana,sans-serif; color: #A2A5A4; font-size: o.70em; } h2{ line-height: 1.5px; font-family: Arial,"Trebuchet ms",Verdana,sans-serif; } #CPF_Web__c,#email,#Phone,#Fname1,#Lname1,#description,#VIN_Web__c,#License_Number_Web__c,#Address,#CEP,#Complemento,#Cidade,#Estado,#ContactMobile{ width: 410px; } #Numero{ width: 150px; } #Endereço{ width: 410px; } #left { float: left; } #right { width: 50%; padding: 0 0 0 10px; } div #backbutton{ float: right; } </style> <Script> function validate(data,name) { var labelName = name; var inputValue = data.value; if(name=='Fname') { callFirstName(inputValue); } if(name=='Lname') { callLastName(inputValue); } if(name=='Surname') { callSecondSurName(inputValue); } if(name=='email') { callEmail(inputValue); } if(name=='phone') { callPhone(inputValue); } if(name=='ContactMobile') { callContactMobile(inputValue); } if(name=='number') { callNumber(inputValue); } if(name=='Street') { callStreet(inputValue); } if(name=='flat') { callFlat(inputValue); } if(name=='door') { callDoor(inputValue); } if(name=='city') { callCity(inputValue); } if(name=='state') { callState(inputValue); } if(name=='vinno') { callVINNo(inputValue); } if(name=='RegNo') { callRegNo(inputValue); } if(name=='km') { callKM(inputValue); } if(name=='casetype' ) { callCaseType(inputValue); } if(name=='descriptionvalid') { callDesc(inputValue); } } function picklistvalidate() { var titleId = document.getElementById("casetype"); var titleValue= titleId.options[titleId .selectedIndex].value; alert('title value 2 is ' + titleValue); callCaseType(titleValue); } </Script> <!--<script> function desc(data) { var inputValue = data.value; alert('Desc value called'+ inputValue); callDesc(inputValue); } </script>--> </head> <form id="formID" > <Label >Si quiere realizar una consulta, una reclamación o hacer una sugerencia, cumplimente por favor el formulario a continuación.Para poder gestionar su petición, necesitamos por favor algunos datos personales. </Label> <br></br><hr color = "white"></hr> <br></br> <label for="Title_Web__c"> Tratamiento*</label><br/> <select id="Title_Web__c" class="validate[required]" name="Title_Web__c" onchange = "picklistvalidate();"> <option value="None">None</option> <option value="Sr.">Sr.</option> <option value="Sra.">Sra.</option> <option value="Sta">Sta.</option> </select><br/> <hr color="white"></hr> <Label for="Lname" >APELLIDO 1*</Label> <br></br> <input id="Lname" value="{!sLastname}" class="validate[required,length[2,20]] text-input " maxlength="20" name="FirstName_Web__c" size="20" type="text" style="width:500px" onblur="validate(this,'Lname');"/> <br></br> <span> <Label for="Fname" >NOMBRE*</Label> <Label for="Surname" >APELLIDO 2*</Label> <br></br> <input id="Fname" value="{!sFirstname}" class="validate[required,length[2,20]] text-input" maxlength="30" name="FirstName_Web__c" size="20" type="text" style="width:250px" onblur="validate(this,'Fname');"/> <input id="Surname" value="{!sSecondSurname}" class="validate[required,length[2,20]] text-input" maxlength="20" name="Surname__c" size="20" type="text" style="width:235px" onblur="validate(this,'Surname');"/> </span> <hr color="white"></hr> <Label for="email" >E-mail*</Label><br></br> <input id="email" value="{!sEmail}" maxlength="80" size="48" class="validate[required,custom[email]]" style="width:500px" onblur="validate(this,'email');"/> <hr color = "white"></hr> <Label for="phone" >Teléfono fijo</Label><br></br> <input id="phone" value="{!sTelephone}" class="validate[optional,custom[telephone]]" maxlength="10" name="phone" size="48" style="width:500px" onblur="validate(this,'phone');"/> <hr color = "white"></hr> <Label for="Mobile">Teléfono móvil*</Label><br></br> <input id="ContactMobile" value="{!sMobilePhone}" class="validate[optional,custom[telephone]]" maxlength="10" size="48" name="Cell_Phone_Web__c" style="width:500px" onblur="validate(this,'ContactMobile');"/> <hr color = "white"></hr> <span> <Label for="Dnumber" >Nº</Label> <Label for="Street" >Calle</Label> <br></br> <input id="number" value="{!sNo}" class="validate[optional ,custom[noSpecialCaracters]]" maxlength="20" name="Dnumber__c" size="20" type="text" style="width:250px" onblur="validate(this,'number');"/> <input id="Street" value="{!sStreet}" class="validate[optional ,custom[noSpecialCaracters]]" maxlength="20" name="Street__c" size="20" type="text" style="width:238px" onblur="validate(this,'Street');"/> </span> <br></br> <hr color="white"></hr> <span> <Label for="flat" >Piso</Label> <Label for="door" >Puerta</Label> <br></br> <input id="flat" value="{!sFlat}" class="validate[optional ,custom[noSpecialCaracters]]" maxlength="20" name="Flat__c" size="20" type="text" style="width:250px" oninput="validate(this,'flat');"/> <input id="door" value="{!sDoor}" class="validate[optional ,custom[noSpecialCaracters]]" maxlength="20" name="Door__c" size="20" type="text" style="width:238px" oninput="validate(this,'door');"/> </span> <br></br> <hr color="white"></hr> <span> <Label for="city" >Ciudad</Label> <Label for="state" >Provincia</Label> <br></br> <input id="city" value="{!sCity }" class="validate[length[2,20]]" maxlength="20" name="City__c" size="20" type="text" oninput="validate(this,'city');"/> <input id="state" value="{!sState }" class="validate[length[2,20]]" maxlength="20" name="State__c" size="20" type="text" oninput="validate(this,'state');"/> </span> <br></br> <hr color="white"></hr> <span> <Label for="vin" >Chasis</Label> <Label for="regno" >Matricula</Label> <br></br> <input id="vinno" value="{!sVIN}" class="validate[clength]" maxlength="17" name="Vin__c" size="20" type="text" oninput="validate(this,'vinno');"/> <input id="RegNo" value="{!sRegNo}" maxlength="20" name="Regnio__c" size="20" type="text" oninput="validate(this,'RegNo');"/> </span> <br></br> <hr color="white"></hr> <Label for="km">Kilómetros</Label> <br></br> <input id="km" value="{!sKilometer}" type="number" oninput="validate(this,'km');"/> <br></br> <hr color="white"></hr> <Label for="casetype">Tipo*</Label><br></br> <select id="casetype" class="validate[required]" name="casetype" onchange = "picklistvalidate();"> <option value="None">None</option> <option value="Solicitud de información">Solicitud de información</option> <option value="Reclamación">Reclamación</option> <option value="Sugerencia">Sugerencia</option> <option value="Other">Other</option> </select><br/> <br></br> <hr color="white"></hr> <!--<Label for="description">Descripción*</Label><br></br> <Textarea id="descriptionvalid" value="{!sDescription}" name="Description" class="validate[required]" maxlength = "800" rows="8" cols="57" onblur= "validate(this,'descriptionvalid');"/> <br></br> <hr color="white"></hr>--> </form> <apex:form id="page"> <apex:actionFunction name="callFirstName" action="{!createcase}" rerender=""> <apex:param name="sFirstname" value="Fname" assignTo="{!sFirstname}"/> </apex:actionFunction> <apex:actionFunction name="callLastName" action="{!createcase}" rerender=""> <apex:param name="sLastname" value="" assignTo="{!sLastname}"/> alert('firstnamevalue'+sLastname); </apex:actionFunction> <apex:actionFunction name="callSecondSurName" action="{!createcase}" rerender=""> <apex:param name="sSecondSurname" value="" assignTo="{!sSecondSurname}"/> </apex:actionFunction> <apex:actionFunction name="callEmail" action="{!createcase}" rerender=""> <apex:param name="sEmail" value="email" assignTo="{!sEmail}"/> </apex:actionFunction> <apex:actionFunction name="callPhone" action="{!createcase}" rerender=""> <apex:param name="sTelephone" value="phone" assignTo="{!sTelephone}"/> </apex:actionFunction> <apex:actionFunction name="callContactMobile" action="{!createcase}" rerender=""> <apex:param name="sMobilePhone" value="ContactMobile" assignTo="{!sMobilePhone}"/> </apex:actionFunction> <apex:actionFunction name="callNumber" action="{!createcase}" rerender=""> <apex:param name="sNo" value="number" assignTo="{!sNo}"/> </apex:actionFunction> <apex:actionFunction name="callStreet" action="{!createcase}" rerender=""> <apex:param name="sStreet" value="Street" assignTo="{!sStreet}"/> </apex:actionFunction> <apex:actionFunction name="callFlat" action="{!createcase}" rerender=""> <apex:param name="sFlat" value="flat" assignTo="{!sFlat}"/> </apex:actionFunction> <apex:actionFunction name="callDoor" action="{!createcase}" rerender=""> <apex:param name="sDoor" value="door" assignTo="{!sDoor}"/> </apex:actionFunction> <apex:actionFunction name="callCity" action="{!createcase}" rerender=""> <apex:param name="sCity" value="city" assignTo="{!sCity}"/> </apex:actionFunction> <apex:actionFunction name="callState" action="{!createcase}" rerender=""> <apex:param name="sState" value="state" assignTo="{!sState}"/> </apex:actionFunction> <apex:actionFunction name="callVINNo" action="{!createcase}" rerender=""> <apex:param name="sVIN" value="vinno" assignTo="{!sVIN}"/> </apex:actionFunction> <apex:actionFunction name="callRegNo" action="{!createcase}" rerender=""> <apex:param name="sRegNo" value="RegNo" assignTo="{!sRegNo}"/> </apex:actionFunction> <apex:actionFunction name="callKM" action="{!createcase}" rerender=""> <apex:param name="sKilometer" value="km" assignTo="{!sKilometer}"/> </apex:actionFunction> <apex:actionFunction name="callCaseType" action="{!createcase}" rerender=""> <apex:param name="sCasetype" value="casetype" assignTo="{!sCasetype}"/> </apex:actionFunction> <apex:actionFunction name="callDesc" action="{!createcase}" rerender=""> <apex:param name="sDescription" value="descriptionvalid" assignTo="{!sDescription}"/> </apex:actionFunction> <input type="hidden" name="CaseBrand__C" value="Dacia" /> <input type="hidden" name="priority" value="Normal"/> <input type="hidden" name="status" value="New"/> <input type="hidden" name="origin" value="DACIA SITE"/> <input type="hidden" id="Language_Web__c" name="Language_Web__c" value="Spanish"/> <input type="hidden" name="CaseSubSource__c" value="Webform"/> <input type="hidden" id="From" name="From__c" value="Customer"/> <input type="hidden" id="recordType" name="recordType" value="{!$Label.RForce_ESCaseRecordType}"/> <input type="hidden" id="CountryCase" name="CountryCase__c" title="Country Case" value="Spain"/> <apex:pageBlock > <apex:pageblocksection > <form> <span class="validate[required]"> <apex:outputLabel for="description">Descripción*</apex:outputLabel><br></br> <apex:inputTextarea id="description" value="{!sDescription }" onblur="validate(this,'descriptionvalid')" onfocus="validate[required]" rows="8" cols="57" /> <hr color = "white"></hr> </span> </form> </apex:pageblocksection> </apex:pageblock> <apex:pageBlock id="blockid"> <apex:pageblocksection > <apex:actionFunction name="ChangeCount" action="{!ChangeCount}" reRender="blockid" /> <apex:pageBlockSectionItem > <apex:outputLabel value="Número de datos adjuntos?"/> <apex:selectList onchange="ChangeCount() ;" multiselect="false" size="1" value="{!sFileCount}"> <apex:selectOption itemLabel="--None--" itemValue=""/> <apex:selectOptions value="{!filesCountList}"/> </apex:selectList> </apex:pageBlockSectionItem> </apex:pageblocksection> <apex:pageBlockSection title="Seleccionar archivos" rendered="{!IF(sFileCount != null && sFileCount != '', true , false)}"> <apex:repeat value="{!allFileList}" var="AFL"> <apex:inputfile value="{!AFL.body}" filename="{!AFL.Name}" /> <br></br> </apex:repeat> </apex:pageBlockSection> <apex:commandButton value="Enviar" action="{!doSubmit}" /> </apex:pageBlock> </apex:form> </apex:page> Controller Code : public with sharing class RForce_ES_Web2Case_Extn { public String sDescription {get;set;} public String sFilename{get; set;} public String sFirstname{get;set;} public String sLastname{get;set;} public String sSecondSurname{get;set;} public String sEmail{get;set;} public String sTelephone{get;set;} public String sMobilePhone{get;set;} public String sCity {get;set;} public String sState {get;set;} public String sVIN {get;set;} public String sRegNo {get;set;} public String sKilometer {get;set;} public String sNo {get;set;} public String sFlat {get;set;} public String sStreet {get;set;} public String sDoor {get;set;} public String sCaseType{get;set;} public Boolean bCaseStatus = false; public List<SelectOption> filesCountList {get; set;} public String sFileCount {get; set;} public List<Attachment> allFileList {get; set;} public Blob blobFilebody {get; set;} public selectoption[] optSalutation{set;get;} public selectoption[] optCaseType{set;get;} public Rforce_ES_Web2Case_Extn(ApexPages.StandardController controller) { filesCountList = new List<SelectOption>() ; sFileCount = '' ; allFileList = new List<Attachment>() ; for(Integer i = 1 ; i < 11 ; i++) filesCountList.add(new SelectOption(''+i , ''+i)) ; } // } public static boolean addAttachment(Case cas, List<Attachment> allFileList, String sFileCount ) { if(sFileCount == null || sFileCount == '') ApexPages.addmessage(new ApexPages.message(ApexPages.Severity.ERROR,'Please select how many files you want to upload.')); List<Attachment> listToInsert = new List<Attachment>() ; for(Attachment a: allFileList) { if(a.name != '' && a.name != '' && a.body != null) listToInsert.add(new Attachment(parentId = cas.Id, name = a.name, body = a.body)) ; } try{ if(listToInsert.size()>0){ insert listToInsert; sFileCount = '' ; } }catch(DmlException e) { System.debug('An exception occurred:' + e.getMessage()); }catch(Exception e) { System.debug('An Generic exception occurred:' + e.getMessage()); } finally { } return true; } public void ChangeCount() { allFileList.clear() ; for(Integer i = 1 ; i <= Integer.valueOf(sFileCount) ; i++) allFileList.add(new Attachment()) ; } public static boolean insertCase(Case c) { try{ insert c; }catch(DmlException e) { System.debug('An exception occurred:' + e.getMessage()); }catch(Exception e) { System.debug('An Generic exception occurred:' + e.getMessage()); } finally { } if(c.id != null){ return true; } else{ return false; } } public void createCase() { } public PageReference doSubmit(){ String sCaseStatus = 'New'; String sCaseBrand = ApexPages.currentPage().getParameters().get('CaseBrand__C'); String sLanguage = ApexPages.currentPage().getParameters().get('Language_Web__c'); String sSubject = ApexPages.currentPage().getParameters().get('subject'); String sPriority = ApexPages.currentPage().getParameters().get('priority'); String sStatus = ApexPages.currentPage().getParameters().get('status'); String sOrigin = ApexPages.currentPage().getParameters().get('origin'); String sCaseSubSource = ApexPages.currentPage().getParameters().get('CaseSubSource__c'); String sFrom = ApexPages.currentPage().getParameters().get('From__c'); String sExternal = ApexPages.currentPage().getParameters().get('external'); String sRecordType = ApexPages.currentPage().getParameters().get('recordType'); String sCountryCase = ApexPages.currentPage().getParameters().get('CountryCase__c'); Case c = new Case ( Subject = sCaseType,CaseBrand__C=sCaseBrand, CaseSubSource__c = sCaseSubSource , Description = sDescription , Cell_Phone_Web__c = sMobilePhone, License_Number_Web__c = sRegNo , SuppliedEmail = sEmail , FirstName_Web__c = sFirstname, LastName_Web__c = sLastname, City_Web__c =sCity , State_Web__c = sState , SuppliedPhone = sTelephone , Status = sCaseStatus , Origin = sOrigin , VIN_Web__c = sVIN , priority = sPriority , Language_Web__c = sLanguage , From__c = sFrom , CountryCase__c = sCountryCase , Address_Web__c = sNo + sStreet + sFlat + sDoor ); try { bCaseStatus = insertCase(c); } catch(DmlException e) { System.debug('Exception while insert' +e.getMessage()); } finally { if(bCaseStatus = true){ addAttachment(c, allFileList, sFileCount ); } } if(sCaseBrand == 'Dacia') { return new PageReference('http://www.dacia.es/'); } else { return new PageReference('http://www.renault.es/'); } } public pagereference createCase11() { system.debug('<<<<<<<inside createcase'+sFirstname); if( sFirstname!=null ) { return doSubmit(); } else { return null; } } }
Hi Rama,
Me too faced same issue previously..
just use <apex:actionRegion> tag before <apex:selectList> and close </apex:actionRegion> after </apex:selectList>.
Thanks,
Vivek Guddeti.
1. attachement doesnt get attached to the case.
2.some values in the text box are not getting mapped in case