function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Amol DixitAmol Dixit 

How to provide custom Validations and Exception Handling

Hi !

 

I have created application based on VF pages and wants to provide the validations and Exception handling. How can I provide my custom Validations & Exception?

 

 

Thank you.

 

Amol Dixit.

 

STest123STest123

global class MyException extends Exception {

global Boolean isCritical { get; private set; }

global MyException( String msg, Boolean isCritical)
{
this(msg);
this.isCritical = isCritical;
}
}

 

if this is correct then tick the answers.

Thanks

Amol DixitAmol Dixit

Thank you for quick response.

 

I wants to provide custom validations as well. I have tried with javascript but didn't worked.

 

   <apex:form >

            <apex:outputPanel >
           
                 <apex:pageBlock title="Resource" mode="edit">
                       <apex:pageBlockSection title="Resource Information" columns="1">
                        <apex:inputField value="{!Res.Employee__c}" id="EmpLookup"/>
                        <apex:inputField value="{!Res.Billed__c}"/>
                        <apex:inputField value="{!Res.Billing_Project__c}"/>
                        <apex:inputField value="{!Res.Work_Project__c}"/>
                        <apex:inputField value="{!Res.EarMarked__c}"/>
                        <apex:inputField value="{!Res.Start_Date_on_SF__c}"/>
                        <apex:inputField value="{!Res.Assessment__c}"/>
                        <apex:inputField value="{!Res.Resource_Status__c}"/>
                        <apex:inputField value="{!Res.Remarks__c}"/>
                        <apex:inputCheckbox label="Certification required ? " value="{!Res.Certification_Required__c}" id="tq" selected="false ">
                             <apex:actionSupport event="onclick" rerender="theBlock" status="AjaxStatus" id="tr" action="{!abc}"/>
                        </apex:inputCheckbox>
                        <apex:selectRadio label="Assign to" layout="pageDirection" value="{!assignTo}">
                            <apex:selectOptions value="{!items}"/>
                            <apex:actionSupport event="onclick" action="{!assign}" reRender="theBlock" status="AjaxStatus"/>
                        </apex:selectRadio>
                       
                   </apex:pageBlockSection>
                </apex:pageBlock>
            </apex:outputPanel>

            <apex:pageBlock rendered="true" >
               <apex:outputPanel id="theBlock" >
                   <apex:actionStatus id="AjaxStatus" startText="Requesting..."/>
                   <apex:pageBlockSection title="Other" columns="2">
                  
                        <apex:inputField value="{!Res.Certification__c}" rendered="{!Res.Certification_Required__c}"/>
                         <apex:inputField value="{!Res.Training_Plan__c}" id="isPlan" rendered="{!isTrainingPlan}" />
                       <apex:inputField value="{!Res.Training_Batch__c}" id="isBatch" rendered="{!isTrainingBatch}"/>
                   </apex:pageBlockSection>
               </apex:outputPanel>
           </apex:pageBlock>

            <apex:commandButton action="{!Save}" value="Next>>" onclick="window.close();"/>
         
</apex:form>

 

Onclick on save button I wants to provide validations on each field.

 

Thank you.