开发者

Pressing enter it refreshes the page with a4j:commandButton

开发者 https://www.devze.com 2023-03-12 17:26 出处:网络
I\'ve got 开发者_StackOverflow中文版this below: <a4j:form> <h:inputText id=\"name\" value=\"#{someBean.item.name}\" styleClass=\"medium-field\" onclick=\"if (this.value == \'Name\') this.va

I've got 开发者_StackOverflow中文版this below:

<a4j:form>
 <h:inputText id="name" value="#{someBean.item.name}" styleClass="medium-field" onclick="if (this.value == 'Name') this.value = ''" onblur="if (this.value == '') this.value = 'Name'" />
 <a4j:commandButton action="#{someBean.find}" styleClass="bt-find" reRender="someFields"/>
</a4j:form>

When I type something on name and press Enter, it refreshes the page and does not bring me any results. If I change it to h:commandButton it works properly. Do you guys have any idea how can I make it work with a4j? If not with a4j, a way to look like a a4j.

Thanks.


Another guy who was trying to figure it out at same time as me added a "type=submit" and it worked.

<a4j:commandButton type="submit" action="#{someBean.find}" styleClass="bt-find" reRender="someFields"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消