You need to sign in to do that
Don't have an account?
Raghuram Gowlikar
after clicking on save button it should show a popup saying error if fields are empty else show success popup and redirect to a page
Hi All,
after clicking on save button it should show a popup saying error if fields are empty else show success popup and redirect to a page?
please help me
after clicking on save button it should show a popup saying error if fields are empty else show success popup and redirect to a page?
please help me
global with sharing class TestPopup {
public Boolean displayPopup {get;set;}
private final contact acct;
public TestPopup(ApexPages.StandardController stdController) {
this.acct = (contact)stdController.getRecord();
}
public void showPopup()
{
displayPopup = true;
}
public void closePopup() {
displayPopup = false;
}
public PageReference redirectPopup()
{
displayPopup = false;
//Please uncomment below 3 statements and replace YourObjectId
PageReference p=new Pagereference('/'+acct.id);
p.setRedirect(true);
return p;
}
}
vf page:
<apex:page standardController="Contact" extensions="TestPopup" >
<style type="text/css">
.customPopup {
background-color: white;
border-style: solid;
border-width: 2px;
left: 20%;
padding: 10px;
position: absolute;
z-index: 9999;
width: 500px;
top: 20%;
}
.disabledTextBox {
background-color: white;
border: 1px solid;
color: black;
cursor: default;
width: 90px;
display: table;
padding: 2px 1px;
text-align:right;
}
.closeButton {
float: right;
}
</style>
<script>
function OpenVfpage() {
window.showModalDialog("/apex/MYVFP?id={!}","dialogWidth:800px; dialogHeight:200px; center:yes");
}
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.';}
if (allow == 'NameAndNumbersWithSpecialCharacter'){AllowableCharacters='1234567890 -\'$%.?-+/& ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';}
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;
}
}
</script>
<apex:form >
<apex:pageBlock title="Text Send" >
<apex:pageBlockSection columns="1" >
<apex:outputText label="Name:" value="" />
<apex:outputText label="Mobile Number:" value="" />
<apex:inputtextarea label="Message:" style="resize:none;width:200px;height:50px;" id="text" onkeypress="return inputLimiter(event,'NameAndNumbersWithSpecialCharacter');" />
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="send" action="{!showPopup}" rerender="popup" status="status"/>
<apex:outputPanel id="popup">
<apex:outputPanel id="popInnerOutputPnl" styleClass="customPopup" layout="block" rendered="{!displayPopUp}">
<apex:commandButton value="X" title="Close the popup" action="{!closePopup}" styleClass="closeButton" rerender="popup">
</apex:commandButton>
<apex:pageblockSection >
<apex:pageblockSectionItem >
<apex:outputLabel value="Message" for="text"></apex:outputLabel>
<apex:outputText value="your message sent successfully" id="string"/>
<!--<apex:outputLabel value="Email" for="address"></apex:outputLabel>
<apex:inputField id="address" value="{!Contact.Email}"/>-->
</apex:pageblockSectionItem>
</apex:pageblockSection>
<apex:commandButton value="Ok" action="{!redirectPopup}" styleClass="closeButton" rerender="popup">
</apex:commandButton>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
this is my code but i need if name field and phone number are empty should through an error, but when i click on send with empty fileds it showing a success pop.
please help me.