Results 1 to 4 of 4

Thread: Change text box values with the dropdown selection

  1. #1
    dskanth is offline Senior Member
    Join Date
    Mar 2009
    Posts
    97

    Default Change text box values with the dropdown selection

    Hello, i have a dropdown in the Accounts module. When i change the dropdown selection, the textbox values at the bottom must be populated with the corresponding values. For example, if i change the City in the dropdown, the address textbox at the bottom must be filled in with the detail from the database.
    Please suggest me, where to make changes (in which file). Your help will be much appreciated.
    Thanks.

  2. #2
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Change text box values with the dropdown selection

    Hi

    Check this. This thread is a very basic example. You need to use AJAX to fetch data from DB.

  3. #3
    dskanth is offline Senior Member
    Join Date
    Mar 2009
    Posts
    97

    Cool Re: Change text box values with the dropdown selection

    i have checked that, but i could not know how to establish connection to the database ?
    Iam getting a fatal error on writing the database connection.

    This is my custom code :

    $query="select * from a234_clinics where id='$id'";
    $res = $db->query($query);
    while ($row = $db->fetchByAssoc($res))
    $row=$db->fetchByAssoc($res);

    Fatal error: Call to a member function query() on a non-object in /opt/lampp/htdocs/sugar51/modules/Contacts/.................... on line 298

    Please can you suggest how to write the database connection, and how to read the values using Ajax ?
    Thanks
    Last edited by dskanth; 2009-04-07 at 12:01 PM.

  4. #4
    crmsiva's Avatar
    crmsiva is offline A Sugar Hero
    Join Date
    Jan 2009
    Location
    Chennai, India
    Posts
    1,130

    Default Re: Change text box values with the dropdown selection

    you need to use the below in the code

    Code:
    global $db;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 2009-04-07, 12:11 PM
  2. how to change dropdown to text?
    By jtan in forum Developer Help
    Replies: 1
    Last Post: 2008-08-18, 11:32 AM
  3. How to change DB values for this DropDown
    By fai.hans in forum Help
    Replies: 2
    Last Post: 2008-04-03, 10:25 PM
  4. Dropdown selection data is stored?
    By damocles in forum General Discussion
    Replies: 2
    Last Post: 2006-03-17, 02:47 AM
  5. Multiple Selection - Dropdown Field
    By aram in forum General Discussion
    Replies: 8
    Last Post: 2005-06-11, 01:09 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
  •