开发者

Allow JSF input text to be selected at first pass, cursor position

开发者 https://www.devze.com 2023-02-05 07:29 出处:网络
We are seeing odd behavior with JSF inputs that we dont see on regular html input fields. The field is a search box, and users will commonly swipe the mouse across the field to highlight all existing

We are seeing odd behavior with JSF inputs that we dont see on regular html input fields.

The field is a search box, and users will commonly swipe the mouse across the field to highlight all existing text, and start overtyping.

You can try this on Google to see what i mean (type a search, leave the field, now clickin on the right side of your entry drag the mouse left - voila, all text is highlighted.)

If we try this exact same process in our JSF app, the cursor just jumps to index 0,开发者_StackOverflow社区 and no text is highlighted. Users must repeat the stpe without leaving the field for it to actually highlight the text.

So my question is a) why the difference b) how to work around it

JSF 2.0 (MOjarra)

<h:inputText 
class="requiredFields" 
id="Search_String" 
value="#{searchManager.searchString}" 
maxlength="#{searchManager.searchTypeMaxLength()}" />


Turns out this was the result of a hacky implementation of some jQuery validation. Once the faulty library was removed the text box behaves like a text box should!

0

精彩评论

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

关注公众号