+ Start a Discussion
Dippan PatelDippan Patel 

Custom validation error on visualforce page

Hi All, 

I have a custom validation error, it is getting displayed on visual force page but my save button keeps running. Below is the screenshot for that. User-added image
<apex:form>

    <apex:pageMessages id ="showmsg"></apex:pageMessages>
    <apex:actionfunction name="lookupDetail" action="{!lookupDetail}" rerender="pnlScriptDupes" />


     <apex:actionfunction name="action_onSave" action="{!onSave1}" oncomplete="testfunc();" rerender="pnlScriptDupes" />
 
 
    <apex:actionfunction name="action_onCancel" action="{!Cancel}" />

    <apex:dynamiccomponent componentvalue="{!Ext.dynamicPageBlock}" rendered="
    
    </apex:pageblock>
    <apex:outputpanel id="pnlScriptDupes">
     
      <div id="pnl-hdn-messages" style="display:none">
      </div>
      
    </apex:outputpanel>
  </apex:form>
 
public PageReference onSave1(){
        Account a = (Account)con.getRecord();

        try{
            insert a;

            String id = ApexPages.CurrentPage().getParameters().get('id');
          
            PageReference ref = new PageReference('/'+a.id);
            ref.setRedirect(true);
            return ref;
        }
        catch(Exception ex){
           
            System.debug(LoggingLevel.ERROR, 'saveError:' + saveError);
            ApexPages.addMessages(ex);
            System.debug(LoggingLevel.ERROR, 'ERROR:  ' + ex);
            System.debug(LoggingLevel.ERROR, 'Inside Catch');
            

        }
       
        return null;
    }



 
Raj VakatiRaj Vakati
Looks like the issue in apex:dynamiccomponent  component .. can you share complete code