문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top