• 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

HTML page refresh

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Html form in which certain feilds are entered by the user.for eg the form contains feilds emp id , description,
and a combo box language . when the user enters the employee id
and selects the language in the combo box, the description in the corresponding language for the employee is to reteived from the database(which is present).can i do this without refreshing the page.
if it can be please give the solution.
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to change the values of one combo box based on the value of another combo box, then you will have to have the data present. By this I mean, you can't have a page talk to the database after the page is loaded, you will have to go to the database, get all the information, and then load the page. HTML is static, so once it reaches the client end, you can't talk to the database without going to the server.
However, there are ways around this. If the data you have is small enough, then you can use javascript to load all the data into an array or mulit-dimensional array using some type of server-side processing like Servlets, JSP, or ASP. Then you have sent all the data over that is necessary, so when the change the combo box, you do have the data to change the other combo box.
All depends on how much data you have, if it is small then the above is a nice solution. If you have a lot of data, then I would either go back to the database by reloading the page, or I would just give them all items and use javascript or server-side form validation to check the page after they submit the data. Sometimes there is just so much hand-holding you can do for the user.
Bill
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
subramaniam g,
Your name doesn't comply with our naming standards here at JavaRanch. Could you please re-register with a more appropriate name. Check out this page for more info, www.javaranch.com/name.jsp
Thanks,
Bill
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bill for the speedy reply.I have re registered as instructed by you.Actually the data to be stored is quite large
and i wouldn't like to store it in the client.pls inform
if there's any other work around
else it's ok.
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't want to send it over then your best option is to either:
1. Keep both drop-downs with all choices and then you javascript and/or server side validation like Servlets, ASP, Coldfusion, CGI, etc... to check the values and either accept or reject them.
2. Or you do your form in steps where the first step is to select this from this list, and then they hit submit, take them to the next page and give them the next list which you can then limit based on what they selected on the last form. You would then probably use hidden fields to keep track of what they selected on the last form so you can submit it all at once when they are finished.
Bill
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic