You need to sign in to do that
Don't have an account?
vicky2489
validation for name field
<apex:page controller="Saved" showHeader="false" sidebar="false"> <apex:form id="ss" > <apex:messages ></apex:messages> <apex:pageblock > <apex:pageblockSection > <apex:pageBlockSectionItem >Name:</apex:pageBlockSectionItem> <apex:pageBlockSectionItem ><apex:inputText value="{!name}" id="name" required="true" /></apex:pageBlockSectionItem> <apex:pageblockSectionItem >Date:</apex:pageblockSectionItem> <apex:pageblockSectionItem ><apex:inputtext onfocus="DatePicker.pickDate(true, this , false);" value="{!dat}" id="dt"/></apex:pageblockSectionItem>
<apex:pageblockSectionItem >Age:</apex:pageblockSectionItem>
<apex:pageblockSectionItem ><apex:outputText value="{!age}" /></apex:pageblockSecti <apex:pageBlockSectionItem >Address:</apex:pageBlockSectionItem> <apex:pageBlockSectionItem ><apex:inputText value="{!address}"/></apex:pageBlockSectionItem> <apex:pageBlockSectionItem >City:</apex:pageBlockSectionItem> <apex:pageBlockSectionItem ><apex:inputText value="{!city}"/></apex:pageBlockSectionItem> </apex:pageblockSection> <apex:pageblockButtons Location="bottom" > <apex:commandButton value="save" action="{!find}"/> </apex:pageblockButtons> </apex:pageblock> </apex:form> <apex:outputLabel value="{!name}"></apex:outputLabel><br/> <apex:outputlabel value="{!dat}"></apex:outputlabel><br/> <apex:outputlabel value="{!age}"></apex:outputlabel><br/> <apex:outputlabel value="{!address}"></apex:outputlabel><br/> <apex:outputlabel value="{!city}"></apex:outputlabel><br/> </apex:page>
public class Saved
{
public string name{get;set;}
public Date dat {get;set;}
public Integer age {get;set;}
public string address{get;set;}
public string city{get;set;}
public void find()
{
Integer temp = dat.daysBetween(Date.Today());
age = Integer.valueOf(temp/365);
}
}
in this i want to do the validation for the name field(it should not contain any numbers ar special characters).if we enter any number it should shoew alert.only alphabets can enter
im new to salesforce i dont know how to do