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
vivek krish 4vivek krish 4 

JQuery alert (MaxLength) Issue on first time ?

Hi All,
          Am creating alert message in controller and called in VF Page by using JQuery.
But,whenever  In Controller & VF Page Code updated (Irrespective of alert related code) means Jquery Pop_Up alert message is not working at first time.If I reduce the length of Pop_Up message then it's getting alert when clicking the button after that if I revert back Pop_Up Error message to normal length also am able to getting alert.

Apex Code :
if(codingChart.MA_User__c == UserInfo.getUserId()){ // And this is the MA Coder
                for(MC_Chart_DxCode__c dx : this.dxCodes){
                    if(String.isBlank(dx.Master_Audit_Primary_Comment__c)){
                        saveAndMoveToNextStageFixMA = true;
                        saveAndMoveToNextStageWarning = 'At least one DxCode is missing an MA primary comment. If you proceed all DxCodes with blank MA primary comments will be updated to [Correct].Are you sure you wish to proceed?';
                        break;
                    }
                }
            }

VF Code :
<apex:page standardController="mc_Chart__c" extensions="MC_ChartCodingExtensions" action="{!PageAction}">
    <apex:outputPanel id="nxtStage">
    <apex:includeScript value="{!$Resource.jquery}"/>
 <script>
        
        var j$ = jQuery.noConflict(); 
         j$(document).ready(function(){
            checkForSaveAndMoveToNextStageWarnings();
          });
          function checkForSaveAndMoveToNextStageWarnings() {            
                var saveAndMoveToNextStageWarningMsg = "{!saveAndMoveToNextStageWarning}";
                if(saveAndMoveToNextStageWarningMsg != ''){ // There was a validation warning, make sure the user still wants to save   
                    if(confirm(saveAndMoveToNextStageWarningMsg)){
                        saveAndMoveToNextStageAction();
                    }
                    else {
                        clearSaveAndMoveToNextStageWarningAction();
                    }
                }
            }

<apex:form >
    <apex:pageMessages />
    <apex:actionfunction name="saveAndMoveToNextStageAction" action="{!saveAndMoveToNextStage}" />
    <apex:actionfunction name="clearSaveAndMoveToNextStageWarningAction" action="{!clearSaveAndMoveToNextStageWarning}" />
<apex:commandButton value="Save & Move to Next Stage" action="{!saveAndMoveToNextStagePreCheck}" reRender="nxtStage"  styleClass="saveButton" />
</apex:outputPanel>
</apex:page>

Static Resource Lib : jquery-1.4.2.js

Can i have suggestion on this ASAP.

Thanks & Regards,
Vivek