DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007
    Location
    Chicago
    Posts
    5

    Update multiple text boxes values with one AJAX Call

    I have a form which contains 1 drop down list abd 4 text boxes; the values for these boxes needs to be updated from the database based on the value from the drop down. Using the onreadystatechange you usually update the innerHTML to a div; how is it possible to update multiple values using the same method or is there other methods?

    Thanks

  2. #2
    Join Date
    Jul 2007
    Posts
    4
    How about grabbing the response text in one variable, then splitting that variable up into bits and then putting those bits into their respective text box.
    PHP Code:
    var someString pageRequest.responseText;
    ...
    var 
    temp someString.split(',');
    text1.value temp[0];
    text2.value temp[1];
    text3.value temp[2];
    text4.value temp[3]; 
    The response text would've been something like:
    thing1,thing2,thing3,thing4

    Assuming you're using PHP you could use the implode function to add those strings together.
    http://php.net/implode <-- Implode reference

    Sorry if I'm way off, I've been using PHP and Javascript for some time but I haven't been using AJAX very long at all.

Similar Threads

  1. Text file update Access Table
    By charligov in forum VB Classic
    Replies: 2
    Last Post: 01-22-2007, 11:00 AM
  2. text boxes
    By MacataQ in forum VB Classic
    Replies: 5
    Last Post: 05-01-2005, 03:43 AM
  3. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  4. reading multiple text files
    By simon in forum XML
    Replies: 6
    Last Post: 07-27-2001, 12:58 PM
  5. default value for text boxes.
    By david in forum ASP.NET
    Replies: 0
    Last Post: 08-02-2000, 01:42 AM

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links