• vicky2489
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 1
    Replies

validation inside the text fields in visualdforce page

<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

i need the validation for the name field.it should not contain numbers and special characters.

<apex:page controoller=""s>

<apex:pageBlockSectionItem >Name:</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem ><apex:inputText value="{!name}" id="name"/></apex:pageBlockSectionItem>
<apex:pageblockButtons >
<apex:commandButton value="save" action="{!find}"/>
</apex:pageblockButtons>
</apex:page>

public class S
{  
    public string name{get;set;}

}

i need the validation for the name field.it should not contain numbers and special characters.

<apex:page controoller=""s>

<apex:pageBlockSectionItem >Name:</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem ><apex:inputText value="{!name}" id="name"/></apex:pageBlockSectionItem>
<apex:pageblockButtons >
<apex:commandButton value="save" action="{!find}"/>
</apex:pageblockButtons>
</apex:page>

public class S
{  
    public string name{get;set;}

how to do validation for name field in visual force page

validation for name field

date calculation in visualforce form

<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