You need to sign in to do that
Don't have an account?
Ravi Prabhu
Having issues with VF page having 2 page blocks
I have a VF page which contains 2 page blocks. One page block will insert the record in custom object. The 2nd page block conatins 2 fields (date and dropdown) after selecting the fields and click of button the records should show in page block.
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
All the fileds on the 1st page block are mandatory. The 1st page block works fine with no issues
.
But when I click 'Go' button on 2nd page block an error shows up on the field of 1st page block.
I have used <actionRegion> as well in 2nd page block but still not working. Please help
Screesnhots are below:
Visualforce page <apex:page Controller="AllTicketReporting" showHeader="false" tabStyle="Ticket_Effort_Category__c" docType="html-5.0"> <script> document.title = "XYZ Reporting"; </script> <script> function DynamicDatePicker(d_id) { DatePicker.pickDate(false,d_id.id,false); } </script> <style type="text/css"> .activeTab {background-color: #236FBf; color:white; background-image:none} .inactiveTab { background-color: white; color:black; background-image:none} body{background-color: #F8F8FF;} .bPageBlock {background-color: #778899 ;} .bAlign {text-align:center;} </style> <apex:panelGrid columns="2" width="100%"> <apex:panelGrid columns="1" width="100%"> <img src="{!$Resource.logo1}" width="100px" height="100px" align="left"/> </apex:panelGrid> <apex:outputlabel style="font-style:regular; font-weight:bold; font-size:30px; font-family:Helvetica; color:DodgerBlue;" value="XYZ Reporting" /> </apex:panelGrid> <apex:form styleClass="myFormStyle" > <!-- Incident reporting --> <apex:pageBlock title="Incident / Problem Reporting" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockTable value="{!tktRecord}" title="Incident Reporting" var="Incident" id="msgsI" > <apex:column headerValue="Date"> <apex:inputField value="{!Incident.Date__c}" required="true"/> </apex:column> <apex:column headerValue="Divsion"> <apex:inputField value="{!Incident.Division__c}" required="true"/> </apex:column> <apex:column headerValue="Application"> <apex:inputField value="{!Incident.Application__c}" required="true"/> </apex:column> <apex:column headerValue="Ticket Number"> <apex:inputField value="{!Incident.Ticket_Number__c}" required="true"/> </apex:column> <apex:column headerValue="Technology"> <apex:inputField value="{!Incident.Technology__c}" required="true"/> </apex:column> <apex:column headerValue="Responsible"> <apex:inputField value="{!Incident.Responsible__c}" required="true" /> </apex:column> <apex:column headerValue="Phase"> <apex:inputField value="{!Incident.Phase__c}" required="true"/> </apex:column> <apex:column headerValue="Effort"> <apex:inputField value="{!Incident.Effort__c}" required="true"/> </apex:column> </apex:pageBlockTable> <apex:pageBlockButtons location="bottom" style="float:centre"> <apex:commandButton value="Save" action="{!saveTicketData}" reRender="msgsI" style="margin-right:20px;"/> <!--apex:commandButton value="Save"> <apex:actionSupport action="{!saveTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:commandButton value="Cancel" action="{!cancelTicketData}" reRender="msgsI" style="margin-right:30px;" /> <!--apex:commandButton value="Cancel"> <apex:actionSupport action="{!cancelTicketData}" event="onchange" rerender="msgsI" /> </apex:commandButton--> <apex:outputLink value="https://curious-impala-lyabo0-dev-ed--c.visualforce.com/apex/ExcepReportDownload?core.apexpages.request.devconsole=1" id="theLink" style="margin-right:600px;">Export</apex:outputLink> </apex:pageBlockButtons> </apex:pageBlock> <apex:actionRegion > <!--Summary section --> <apex:pageBlock title="Summary" id="msgsS" tabStyle="Ticket_Effort_Category__c" > <apex:pageBlockSection > <apex:OutputPanel > <apex:panelGrid columns="5"> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Date </apex:outputLabel> <apex:inputText id="time" value="{!SelectedDate}" onfocus="DynamicDatePicker(this);" onchange="checkDateFormatt(this.id);" size="10" disabled="false" style="width:90px; margin-right:10px;"/> <apex:outputLabel style="font-style:regular; font-weight:bold; font-size:11px; font-family:Helvetica;"> Select Assigned Person </apex:outputLabel> <apex:selectList value="{!selecteduserId}" size="1" multiselect="false" style="margin-right:10px;" > <apex:selectOptions value="{!ListOfUser}" /> </apex:selectList> <!--apex:commandButton value="Go" action="{!showPB}" reRender="msgsS" /--> <apex:commandButton value="Go"> <apex:actionSupport action="{!showPB}" event="onchange" rerender="msgsS" /> </apex:commandButton> </apex:panelGrid> </apex:OutputPanel> </apex:pageBlockSection> <!--Summary--> <apex:pageBlockTable value="{!fetchlist}" var="I" > <apex:column headervalue="Date" value="{!I.Date__c}"/> <apex:column headervalue="Date" value="{!I.Ticket_Number__c}"/> <apex:column headervalue="Division" value="{!I.Division__c}"/> <apex:column headervalue="Application" value="{!I.Application__c}"/> <apex:column headervalue="Responsible" value="{!I.Responsible__c}"/> <apex:column headervalue="Effort" value="{!I.Effort__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page> Apex controller: public class AllTicketReporting { public Ticket_Effort_Category__c tktRecord{set;get;} public list<Ticket_Effort_Category__c> fetchList{get;set;} public list<Ticket_Effort_Category__c> userList{get;set;} public String selecteduserId {set;get;} public Date selectedDate {set;get;} public boolean PBFlag{set;get;} public AllTicketReporting() { tktRecord = new Ticket_Effort_Category__c(); selecteduserId =''; } public Pagereference saveTicketData(){ List<Ticket_Effort_Category__c> ticketExist = new List<Ticket_Effort_Category__c> (); ticketExist = [select id from Ticket_Effort_Category__c where Ticket_Number__C = :tktRecord.Ticket_Number__C ] ; try{ // if(!ticketExist.isEmpty()){ // tktRecord.id = ticketExist[0].id; // upsert tktRecord; // // }else{ insert tktRecord; // } PageReference pr = new PageReference('/apex/TicketReporting?core.apexpages.request.devconsole=1'); pr.setRedirect(true); return pr; } catch(Exception e){ String error = e.getMessage(); ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,error)); return null; } } public Pagereference cancelTicketData() { tktRecord = new Ticket_Effort_Category__c(); return null; } public list<Ticket_Effort_Category__c> summarylist(){ fetchList = new list<Ticket_Effort_Category__c>(); if(string.isNotEmpty(selecteduserId) || (system.today() < selectedDate)){ fetchList = [select Date__c, ticket_number__c, Division__c, Application__c, Responsible__c, Effort__c from Ticket_Effort_Category__c where Responsible__c = :selecteduserId and Date__c = :selectedDate]; PBFlag = false; return fetchlist; }else { ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Please enter Account phone')); return null; } } public void showPB(){ PBFlag=true; } public List<SelectOption> getListOfUser(){ List<SelectOption> selectOptions = new List<SelectOption>(); selectOptions.add(new SelectOption( ' ' ,'---Select---')); Schema.DescribeFieldResult describeResult = Ticket_Effort_Category__c.Responsible__c.getDescribe(); List<Schema.PicklistEntry> pickListEntries = describeResult.getPicklistValues(); for( Schema.PicklistEntry eachEntry : pickListEntries) { selectOptions.add(new SelectOption(eachEntry.getLabel(), eachEntry.getValue())); } return selectOptions; } }
All Answers