Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form in Jsp

 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form in jsp consisting of emp no and emp name.
Now what i want is when i enter emp no than emp name of that employee should automatically be displayed fetching from database.
Please help
 
Ajith Pande
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
if you want see name of a employee dynamically then u shud dispaly employee numbers in dropdown list b'coz for toching database some event shud happen.
regards
Ajith
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the list of employees r too long to show in drop down menu.
Is there any other way.?Pls help
 
Balan Raj
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show a text field for emp id & disabled list box for emp name initially. Once the user tabs out of the text field or hits the enter key, handle the event and submit the page. The submission of the form, should make the necessary DB hit to get the appropriate (or related set ) of emp names.
If there is too much data, I don't see the list box as an option..
hope this helps..
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can u pls tell me with code...like i have been trying to do this since long without any result.
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
for this i think u can do like this.
u call a function on onblur event of a textbox and there u submit the form.
something similar to
<input name=text onblur="call();">
in the call function u can submit the form.
hope this helps
jyothsna
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to do it since in the function i need to get connected to database to get the emp name.Than how to connect from jsp to javascript fnction and than connect to database in javascript?
so pls give soln in jsp..?
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can do like this.
create a function which u want to call on onblur event like this
<script language="javascript">
function call()
{
---
-----
}
</script>
here u write the necessary code.
or u can submit the form and do the things related to the database and then come back to the jsp page and display the results.
still have problems,ask me
jyothsna
 
Malhar Barai
Author
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is quite raw, you can do in more cleaner way.
Now in the html you can do something like this...

hth
MB
ps. do chk out for the proper javascript statment to submit the form & to diable a form element, am not quite sure abt them.
[ November 11, 2003: Message edited by: Malhar Barai ]
 
rose hegde
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what i really want...
There r many fields in the form ...the first 2 are emp no and emp name...in jsp page!!
Now when the user enters the no in the first field...the emp name of that particular employee should be displayed fetching from the database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic