You need to sign in to do that
Don't have an account?
Ab
command button to clear the input text values
Hello,
I have a button like below,
thank you for suggestions !!
I have a button like below,
<apex:inputText value="{!search}" id="search" />
controller{ public String search{get;set;} funtion(){ } }I want to have a another button , which will clear the input text on front end and also in the back end
thank you for suggestions !!
Otherise, you could write another Apex method called clear that sets your search member variable to an empty string, and then call that via an action function.
All Answers
Otherise, you could write another Apex method called clear that sets your search member variable to an empty string, and then call that via an action function.
Hi Sandrine,
Are you saying you want to clear all the textboxes values in your form?
If yes, then you can use javascript form.reset() method
The reset() method resets the values of all elements in a form
<script>
function cleartext(){
document.getElementsByClassName('abc')[0].reset();
}
</script>
<apex:form id="frm" html-class="abc">
<apex:inputtext />
<apex:inputtext/>
<apex:commandbutton value="clear values" onclick="cleartext();return false;"/>
</apex:form>