Question

I'm using JSF 1,2 and I want the browser to retain previously entered values in h:inputText.

<h:inputText
id="testContact"
value="#{ObjectBeanHolder.testContact.targetAddress}"                           
onkeypress="if(event.keyCode==13) {setTimeout(function() {jQuery('input[id$=startTestButtonId]').click()}, 100);  return false;} "
styleClass="text-input testContact"  required="true"
label="#{fieldTitle}">

Is it possible? Or should I use another component to make a simple conservation, Thanks.

Was it helpful?

Solution

Browsers are keeping data for autocomplete on fields based on the website and input ID (when defined).

In the JSF case, form and input have automatically generated ID's when they are not defined. ID's can change at each application deployment, that is why it is not working in some case. To prevent this, one way is to define ID's to form and input that you want to activate autocomplete.

Note : The browser also need a submit to keep these values.

OTHER TIPS

I found that a4j command buttons which I use have "return false;" statement in onclick event. So submit and autocomplete don't work on the page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top