SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JSP select list dynamically fills textbox

    Hi, I'm a newbie here and would really really appreciate some help. Its 5.30am and I've been all night searching for a way how to populate a textbox from a select list. Basically this is a school thesis and I am working with JSP and I have a database(MySQL) with a table clients. All I want is that when the user selects the client's name the Address and city are picked up from the database and placed in the relative textboxes. So far I have managed to create a dynamic select list which shows the people in the DB but I haven't managed to create the Postback/Javascript to update the textboxes accordingly. If this is remotely possible I would be so grateful for any help!

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Dru011 View Post
    Hi, I'm a newbie here and would really really appreciate some help. Its 5.30am and I've been all night searching for a way how to populate a textbox from a select list. Basically this is a school thesis and I am working with JSP and I have a database(MySQL) with a table clients. All I want is that when the user selects the client's name the Address and city are picked up from the database and placed in the relative textboxes. So far I have managed to create a dynamic select list which shows the people in the DB but I haven't managed to create the Postback/Javascript to update the textboxes accordingly. If this is remotely possible I would be so grateful for any help!
    Typically the PHP side converts the data into a string of JSON data, which can then be received by the client and easily processed.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Thanks for your reply. I was trying to do something (still unsuccessful) with JavaScript and AJAX ... I have created a getClient.jsp and tried to adapt some javascript / AJAX code on the page addInvoice.jsp I found on the net to link to it when an onchange event from the select list is fired ... for some odd reason tho the onchange statement is not going to the javascript function and I'm finding it hard to debug since the page is already rendered!

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Dru011 View Post
    Hi Thanks for your reply. I was trying to do something (still unsuccessful) with JavaScript and AJAX ... I have created a getClient.jsp and tried to adapt some javascript / AJAX code on the page addInvoice.jsp I found on the net to link to it when an onchange event from the select list is fired ... for some odd reason tho the onchange statement is not going to the javascript function and I'm finding it hard to debug since the page is already rendered!
    If it's of any help, we'll most likely have the same trouble due to your working in jsp, which is Java, something completely different from JavaScript. We do have a Java and JSP forum though, where you are more likely to receive a viable solution for your situation.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you some much Paul for your time Your effort was much appreciated. I will check it out then and see if they can guide me out of my dark forest hehe


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •