Re: From <Select> to Textbox
That's because it's just document.getElementById(). Don't call the form. Also, I would recommend downloading Firefox and using their JavaScript debugger. It will help you greatly.
Re: From <Select> to Textbox
Downloaded JavaScript debugger...kind of cool.
The problem seems to be the HTML not the JavaScript.
EDIT: Accidentally edited instead of quoting.
Re: From <Select> to Textbox
Your problem is the HTML. You have onselect in your select tag. Use onchange.
Re: From <Select> to Textbox
i can not believe that i had been trying to debug such a mistake for sooo long..
Guess what even onChange does not work.. and i am still trying to find out why
gonna break my box today :$
kimoo
Re: From <Select> to Textbox
NOOOOOOOOOOOOOO
the problem was in two things
1. onSelect had to be onChange
2. Guess this just guess the 'F' of the word function in the Javascript was UpperCase and it had to be LowerCase
OMG ~ i just love programming..
kimoo
Re: From <Select> to Textbox
Quote:
Originally Posted by kimoo
2. Guess this just guess the 'F' of the word function in the Javascript was UpperCase and it had to be LowerCase
What I said was correct with the onchange. Funny though, I didn't event thing about F instead of f. Sometimes you just look over things.
Re: From <Select> to Textbox
I think to get value from select element first you to get its selected index and then from options array get its value. For example
Code:
<select name="abc" id="abc" onchange="showSelectedValue()">
<option value="A">A
<option value="B">B
<option value="C">C
</select>
function showSelectedValue()
{
var selectedIndex = document.getElementById('abc').selectedIndex;
alert(document.getElementById('abc').options[selectedIndex].value);
}
Re: From <Select> to Textbox
Quote:
Originally Posted by Waqas_Badar
I think to get value from select element first you to get its selected index and then from options array get its value.
You miss the point. The point was to fill the textbox when a user selects something from the drop-down. Not alter the drop-down by using JavaScript.
Anyway, the issue has already been resolved.