+ Start a Discussion
FacebookFacebook 

Resetting a page or Form

Hi,

Can anyone help me in resetting a visualforce page or form by using java script...

i have three textboxes in a form and when the reset button is clicked the values in the boxes should be cleared...

 

 

 

regards,

Abhi

CaptainObviousCaptainObvious

Have you tried setting the button type to 'reset'?

 

<apex:pageBlockButtons >
    <apex:commandButton value="Save" action="{!save}"/>
    <input class="btn" type="reset" value="Reset" />
    <apex:commandButton value="Cancel" action="{!cancel}"/>         
</apex:pageBlockButtons>

 

Pradeep_NavatarPradeep_Navatar

Tryout the code given below :

 

<apex:page controller=”my_controller”>

<script>

Function resetValue()

{

Var.getElementById(“{!$Component.frm.name}”);

Name.value=’’;

}

</script>

 

<apex:form id=”frm”>

 <apex:outputLabel value=”Name”/>

<apex:inputText value=”{!}” id=”name”/>

<apex:commandButton value=”Reset” onclick=”resetValue();”/>

</apex:form>

</apex:page>

shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com

How will we reset if there is a picklist/ look up field?

CodeFinderCodeFinder

Thanks buddy. I needed that. Helped me a lot.