You need to sign in to do that
Don't have an account?

Immediate = True is not working to stop validation message in visualforce page
Hi,
In below visualforce page i tried adding immediate = true in button also in <apex:actionRegion immediate="true"> but this is not working can you please suggest me how to by pass the opportunity validation message
Thanks
Sudhir
In below visualforce page i tried adding immediate = true in button also in <apex:actionRegion immediate="true"> but this is not working can you please suggest me how to by pass the opportunity validation message
<apex:page standardController="Opportunity" extensions="OptyLineEditCnt" id="pg" sidebar="false" docType="html-5.0"> <style> .oddprnv { background-color: #FFFFFF; } .evenprnv { background-color: #f4efbc; } .txtalign{ text-align:center; } .wdh{ width:36%; } </style> <script> function inputLimiter(e,allow) { var AllowableCharacters = ''; if (allow == 'Letters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';} if (allow == 'Numbers'){AllowableCharacters='1234567890';} if (allow == 'NameCharacters'){AllowableCharacters=' ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.\'';} if (allow == 'NameCharactersAndNumbers'){AllowableCharacters='1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-\'';} if (allow == 'Currency'){AllowableCharacters='1234567890.';} var k = document.all?parseInt(e.keyCode): parseInt(e.which); if (k!=13 && k!=8 && k!=0){ if ((e.ctrlKey==false) && (e.altKey==false)) { return (AllowableCharacters.indexOf(String.fromCharCode(k))!=-1); } else { return true; } } else { return true; } } function isNumberKey(sender, evt) { var txt = sender.value; var dotcontainer = txt.split('.'); var charCode = (evt.which) ? evt.which : event.keyCode; if (!(dotcontainer.length == 1 && charCode == 46) && charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } </script> <script> function displayImage(value,index) { var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow"); if ( value == true ) { yellow.style.display = 'block'; } else { yellow.style.display = 'none'; } } function displayImagesp(index) { var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow"); yellow.style.display = 'block'; } function displayImagedr(index) { var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow"); yellow.style.display = 'block'; } function displayImagedrr(index) { var yellow = document.getElementById("pg:frm:pb2:pbt2:"+index+":oppStatusYellow"); yellow.style.display = 'block'; } function discountlimit(value,index){ if(value <0 || value >100) { document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrDiscountRate").innerHTML = 'Discount must be no more than 100'; document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").style.color = 'RED'; document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").value = ''; } else { document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrDiscountRate").innerHTML = ''; document.getElementById("pg:frm:pb2:pbt2:"+index+":DiscountRate").style.color = 'BLACK'; } } function resellerdiscountlimit(value,index){ if(value <0 || value >100) { document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrResellerDiscountRate").innerHTML = 'Discount must be no more than 100'; document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").style.color = 'RED'; document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").value = ''; } else { document.getElementById("pg:frm:pb2:pbt2:"+index+":ErrResellerDiscountRate").innerHTML = ''; document.getElementById("pg:frm:pb2:pbt2:"+index+":ResellerDiscountRate").style.color = 'BLACK'; } } function GrandTotalPrice(){ alert('sudhir' + document.getElementById("pg:frm:pb2:pbt2:"+0+":TotalPrice").value ); var Gtot = document.getElementById("pg:frm:pb2:pbt2:"+0+":TotalPrice").value; document.getElementById("pg:frm:pb2:pbt2:"+5+":TotalPrice").innerHTML = '1'; } function fltrdiscountrate(){ var value; value = document.getElementById("pg:frm:pb2:prodcatdiscount").value; if(value <0 || value >100) { alert('Discount cannot be more than 100'); document.getElementById("pg:frm:pb2:prodcatdiscount").value = ''; document.getElementById("pg:frm:pb2:prodcatdiscount").style.color = 'RED'; } } function checkdiscountrate(){ var value; value = document.getElementById("pg:frm:pb2:prodcatdiscount").value; if(value == "") { alert('You have applied blank value to discount'); } } function selectCheckboxes(inpt,receivedInptID) { var inputCheckBox = document.getElementsByTagName("input"); for(var i=0; i<inputCheckBox.length; i++) { if(inputCheckBox[i].id.indexOf(receivedInptID)!=-1){ inputCheckBox[i].checked = inpt.checked; } } } </script> <script> var counter = 0; function incrementCounter(checked) { if (checked) { counter++; } else { counter--; } } function incrementcheckall(val,checked){ if (checked) { counter = val; } else { counter = 0; } } function DeleteConfirmation(val) { if ( counter == 0 ) { alert('Please select at least one Product to delete'); } else { return confirm('Number of records selected ' + counter + ' out of ' + val); } } </script> <apex:form id="oppfrm"> <apex:pageBlock title="Opportunity Details"> <apex:pageBlockSection columns="2" > <apex:outputField style="font-weight:500" value="{!opportunity.name}"/> <apex:outputField style="font-weight:500" value="{!opportunity.stagename}"/> <apex:outputField style="font-weight:500" value="{!opportunity.closedate}"/> <apex:outputField style="font-weight:500" value="{!opportunity.Distributor__c}"/> <!-- <input id="theHiddenInput" type="hidden" name="theHiddenInput" /> --> <apex:outputField style="font-weight:500" label="Original Amount" value="{!opportunity.amount}"/> <apex:outputText id="differenceamount" style="font-weight:500" label="Differnce Amount" value="${0, number, ###,##0.00}"> <apex:param value="{!differenceamount}"/> </apex:outputText> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <apex:form id="frm"> <apex:actionRegion immediate="true"> <apex:pageBlock title="Edit Opportunity Products" id="pb2"> <apex:pageBlockButtons id="pgbutn" > <apex:commandButton value="Quick Save" action="{!quicksavelns}" style="background:LightBlue;width:85px;" title="Help" immediate="true"/> <apex:commandButton value="Save & Close" action="{!savelns}" style="background:LightBlue;width:85px;" title="Help" immediate="true"/> <apex:commandButton value="Delete" action="{!deletelns}" onclick="if(!DeleteConfirmation({!numberofrecords})){return false};" style="background:LightBlue;width:85px;" title="Help" immediate="true"/> <apex:commandButton action="{!cancelbtn}" value="Cancel" style="background:LightBlue;width:85px;" title="Help"/> <apex:commandButton action="{!refreshbtn}" value="Reset All" onclick="if(!confirm('Are you sure you want to undo all changes?')){return false};" style="background:LightBlue;width:85px;" title="Help" immediate="true"/> </apex:pageBlockButtons> <apex:panelGrid columns="3" id="theGrid" columnClasses="wdh"> <apex:outputText /> <apex:panelGroup > <apex:outputText value="Product Category"/> <apex:selectList size="1" value="{!selectlistvalue}" label="Product Category" style="width:80px;"> <apex:selectOptions value="{!ProdCatList}"></apex:selectOptions> </apex:selectList> <apex:outputText value="Discount"/> <apex:inputText id="prodcatdiscount" value="{!prodcatdiscount }" label="Product Discount" style="width:50px;" onkeypress="return isNumberKey(this, event);" onkeyup="fltrdiscountrate();"/> <apex:commandButton action="{!applydscnt}" value="Apply" onclick="if(!confirm('Apply discount to all products of that category?')){return false};" style="background:LightBlue;width:80px;"/> <!-- onclick="checkdiscountrate(); --> </apex:panelGroup> </apex:panelGrid> <apex:pageBlockTable rowClasses="evenprnv, oddprnv" value="{!lineWrapr}" var="l" Width="100%" id="pbt2"> <apex:variable var="index" value="{!0}" id="oppIndex" /> <apex:variable var="indexsp" value="{!0}" id="oppIndexsp" /> <apex:variable var="indexdr" value="{!0}" id="oppIndexdr" /> <apex:variable var="indexdrr" value="{!0}" id="oppIndexdrr" /> <apex:column > <apex:facet name="header"> <apex:inputCheckbox onclick="selectCheckboxes(this,'inputId'), incrementcheckall({!numberofrecords},this.checked)"/> </apex:facet> <apex:inputCheckbox id="inputId" title="Delete" value="{!l.selected}" onclick="incrementCounter(this.checked);"> </apex:inputCheckbox> </apex:column> <apex:column headerValue="Product" style="width:35%;text-align:left;"> <apex:outputLink target="_blank" value="/{!l.line.Product2Id}">{!l.line.PricebookEntry.product2.name}</apex:outputLink> </apex:column> <apex:column headerValue="Product Code" > <apex:outputLink target="_blank" value="/{!l.line.Product2Id}">{!l.line.PricebookEntry.productcode}</apex:outputLink> </apex:column> <apex:column headerValue="Product Category" style="text-align:center;"> <apex:outputText value="{!l.line.PricebookEntry.product2.Category__c}"> </apex:outputText> </apex:column> <apex:column headerValue="List Price"> <apex:inputfield id="ListPrice1" value="{!l.line.listprice}" rendered="{!l.line.PricebookEntry.name != 'COTERM'}" style="width:50px"></apex:inputfield> <apex:inputfield id="ListPrice2" required="true" value="{!l.line.CoTerm_List_Price__c}" rendered="{!l.line.PricebookEntry.name == 'COTERM'}" OnKeyPress="return isNumberKey(this, event);" style="width:50px"> <apex:actionSupport event="onchange" action="{!calcOnSalchange}" rerender="DiscountRate,TotalPrice,ResellerDiscountRate,GrandTotalPrice,editstatus" status="assigncoterm" /> <apex:actionStatus id="assigncoterm" startText="updating.." stopText=""/> </apex:inputfield> </apex:column> <apex:column headerValue="Quantity" style="text-align:center;"> <apex:inputfield id="Quantity" value="{!l.line.Quantity}" OnKeyPress="return inputLimiter(event,'Numbers');" Onkeyup="displayImage({!l.line.Quantity},{!index-1});" style="width:60px"> <apex:actionSupport event="onchange" action="{!calcOnQntchange}" rerender="Quantity,TotalPrice,GrandTotalPrice,editstatus,oppfrm" status="assign1" /> <apex:actionStatus id="assign1" startText="updating.." stopText=""/> </apex:inputfield> <apex:variable var="index" value="{!index + 1}" /> </apex:column> <apex:column headerValue="Sales Price" style="text-align:center;"> <apex:inputfield id="Unitprice" required="true" value="{!l.line.UnitPrice}" OnKeyPress="return isNumberKey(this, event);" onkeyup="displayImagesp({!indexsp-1});" style="width:60px"> <apex:actionSupport event="onchange" action="{!calcOnSalchange}" rerender="DiscountRate,TotalPrice,ResellerDiscountRate,GrandTotalPrice,editstatus,oppfrm" status="assign2" /> <apex:actionStatus id="assign2" startText="updating..." stopText=""/> </apex:inputfield> <apex:variable var="indexsp" value="{!indexsp + 1}" /> </apex:column> <apex:column headerValue="Disti Discount" style="text-align:center;"> <apex:inputfield id="DiscountRate" value="{!l.line.Discount_rate__c}" OnKeyPress="return isNumberKey(this, event);" onkeyup="discountlimit(this.value,{!indexdr-1}); displayImagedr({!indexdr-1});" style="width:60px"> <apex:actionSupport event="onchange" action="{!calcOnDistchange}" rerender="Unitprice,ResellerDiscountRate,editstatus" status="assign3" /> <apex:actionStatus id="assign3" startText="updating.." stopText=""/> </apex:inputfield> <apex:outputText id="ErrDiscountRate" value="" /> <apex:variable var="indexdr" value="{!indexdr + 1}" /> </apex:column> <apex:column headerValue="Reseller Discount Rate" style="text-align:center;"> <apex:inputfield id="ResellerDiscountRate" value="{!l.line.Reseller_discount_rate__c }" OnKeyPress="return isNumberKey(this, event);" onkeyup="resellerdiscountlimit(this.value,{!indexdrr-1}); displayImagedrr({!indexdrr-1});" style="width:60px" > <apex:actionSupport event="onchange" action="{!callDistSaleMth}" rerender="DiscountRate,Unitprice,editstatus" status="assign4" /> <apex:actionStatus id="assign4" startText="updating.." stopText=""/> </apex:inputfield> <apex:outputText id="ErrResellerDiscountRate" value="" /> <apex:variable var="indexdrr" value="{!indexdrr + 1}" /> <apex:facet name="footer"> <apex:outputText value="Grand Total"/> </apex:facet> </apex:column> <apex:column headerValue="Total Price"> <apex:outputfield id="TotalPrice" value="{!l.line.TotalPrice}"/> <apex:facet name="footer"> <apex:outputText id="GrandTotalPrice" value="${0, number, ###,##0.00}"> <apex:param value="{!grandtotal}"/> </apex:outputText> </apex:facet> </apex:column> <!-- <apex:column headerValue="Status" width="3%" id="status"> <apex:image alt="" url="{!URLFOR($Resource.ForecastingTab,'forecastdata/images/yellow-bullet.png')}" id="oppStatusYellow" title="This opportunity has pending updates and will be updated when save button is clicked." style="display:none;"/> </apex:column> --> <apex:column headerValue="Status" width="3%" id="editstatus"> <apex:image url="{!URLFOR($Resource.ForecastingTab, 'forecastdata/images/yellow-bullet.png')}" rendered="{!l.editcheck}"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:actionRegion> </apex:form> </apex:page>
Thanks
Sudhir
mmediate="true" html-formnovalidate="true"
This must wrok for you, Please let me know if still does not work