how to reset form filelds
Hi,
i have some fileds in a form, after entering all i save record by clicking on Save button, after that form showing some values in the form that are previously entered.(like htmlInputText)
I have to show empty screen once record added.how can i do that in backing bean.
Thanx
[303 byte] By [
veerjaa] at [2007-11-27 3:02:52]

# 2
I have resetValue() in UIInput , HtmlInputText extends UIInput, so by binding h:inputText with HtmlInputText at managed bean im trying to call resetValue. but it is not shown in my IDE when called on HtmlInputTextWhat is the reason.
# 3
Likely you're overthinking it. You don't need the component itself.
Here is a basic example:
<h:form>
<h:inputText value="#{myBean.myForm.input1}" />
<h:inputText value="#{myBean.myForm.input2}" />
<h:inputText value="#{myBean.myForm.input3}" />
<h:commandButton value="save" action="#{myBean.save}" />
</h:form>
MyBeanprivate MyForm myForm = new MyForm(); // + getter + setter
public void save() {
SomeDao.save(myForm);
myForm = new MyForm();
}
MyFormprivate String input1;
private String input2;
private String input3;
// + getters + setters
# 5
> if it like this then empty HtmlForm displayed.
Leave "new MyForm()" away from the private MyForm declaration. I had session scope in mind. For request scope precreate it on "add" action.
> i need my form which i submitted with some values
> reset.
>
> i can do this simply by calling resetValue method
> coz every input item extends UIInput.
OK, if you want to do this way, go ahead. Everyone has it's own opinion about handling input values :)