cesarcesar Posted September 11, 2008 Share Posted September 11, 2008 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. <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. Link to comment https://forums.phpfreaks.com/topic/123814-inserting-htmlinput-element-value/ Share on other sites More sharing options...
cesarcesar Posted September 12, 2008 Author Share Posted September 12, 2008 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. Link to comment https://forums.phpfreaks.com/topic/123814-inserting-htmlinput-element-value/#findComment-639596 Share on other sites More sharing options...
cesarcesar Posted September 17, 2008 Author Share Posted September 17, 2008 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 again. Any ideas on hoe to get it to set the first time? Link to comment https://forums.phpfreaks.com/topic/123814-inserting-htmlinput-element-value/#findComment-643620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.