How to reset a visualforce page in Salesforce?

Sample Code:

Visualforce page:

<apex:page controller="Sample">
<apex:form >
    <apex:pageBlock >
        <apex:panelGrid >
            Name: <apex:inputtext />
            Age: <apex:inputtext />
            Addres: <apex:inputTextarea />                       
        <apex:pageBlockButtons >
            <apex:commandButton value="Reset" action="{!reset}"/>

Apex Controller:

public without Sharing class Sample {
    public Sample() {
    public PageReference reset() {
        PageReference pg = new PageReference(System.currentPageReference().getURL());
        return pg;

1 comment:

Sharing is Caring!!! Share this with your friends!!!

submit to reddit