DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Inserting HTMLInput Element value

  1. #1
    Join Date
    Feb 2007
    Posts
    79

    Inserting HTMLInput Element value

    I have a textfield that uses a dynamic dropdown select script to let me choose a country by a few letters. Example, keying "B" shows "Brazil, Bulgaria, Belarus... Once i choose a county another function fires to send the selected data via http_request to another page. Here's it in use.

    Code:
    <input type="text" name="country" onkeyup="ajax_showOptions(this,'get_country',event)" onblur="makeRequest('insert.php?field_name=country&field_value=',this.value)">
    The problem is that the *this.value* in makeRequest() only sends the "B" or whatever chars where entered in the field. Now I understand that the dropdown script is filling the field in a different way than I would have keyed it but how im not sure. Looking at FireBug i think i see that my selection "Brazil" shows under *HTMLInputElement*. I guess my question is how do i get that value to show instead of *this.value* in makeRequest().

    FYI, each script works fine when not working together on the same field.

    Thanks much for the help.

  2. #2
    Join Date
    Feb 2007
    Posts
    79
    thanks to BrianOConnell -

    Solution - replace *this.value* with *document.getElementById('country_hidden').value*.

    The country_hidden element was not in my initial post because i didn't think it was relevant.. bad me. It is shown in the original example linked in my post.

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Thank you for coming back and posting your solution.

    Hopefully it will help others that may have the same, or similiar, problem.

  4. #4
    Join Date
    Feb 2007
    Posts
    79
    darn.. found a glitch. the *document.getElementById('country_hidden').value* will not set on the first call of makeRequest(). It will though set if i re-select the drop down value. Any ideas on hoe to get it to set the first time?

Similar Threads

  1. Finding XML-data in a textbox
    By Rens.Duijsens in forum .NET
    Replies: 4
    Last Post: 08-28-2008, 11:30 AM
  2. XML-file --> Read --> Display selection
    By Rens.Duijsens in forum .NET
    Replies: 23
    Last Post: 03-08-2008, 07:44 PM
  3. Replies: 2
    Last Post: 11-26-2007, 11:06 AM
  4. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 08:10 PM
  5. AVL Tree element index
    By John in forum Java
    Replies: 2
    Last Post: 04-29-2001, 05:01 PM

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center