• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how to focus input field in jsp without using javascript

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have jsp page with 2 input fields username and password.
after i enter username and password, it will navigate to next page and if username or password is incorrect, i have a hyperlink to navigate to login page where i need to focus on username field.
my question is how to focus on username field without using javascript.

Thanks,
Jagadish.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is no alternative. you have to you javascript
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vinutha, If on normal loading and in case of authentication failure you are focusing same element then you can use onload focus technique.
Use below tag in your page body.

<body onload="document.myform.infield.focus()">
This way, when your page gets loaded it will focus the required element. And as per my understanding, you are reloading the page on authentication failure. so again it will focus User Name field.

Hope it solves your problem.
 
I just had the craziest dream. This tiny ad was in it.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic