• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cursor defaults to inputtext box

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when the user is in application login screen how can i make the cursor default to inputtext box to enter username
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you actually are asking is how to cause the input focus to be set to the username textbox control.

You cannot do that using server-side code, because it's a client-side action.

However you can setup an onload javascript event handler on your web page (login form) that can execute JavaScript code that will give the focus to the username control.
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was able to do for login screen using below code

<body onload="document.login_form.j_username.focus()">

-------------------------

But i want same functionality in my application for one of the field

And since i am using Facelets with JSF/RichFaces

my body tag is base.xhtml page and my actual page is search.xhtml

so in this case, how can i do
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic