Select option value with "other" when usesr select when input filed

Hi,
I’m looking to accomplish in the Form when user select “others” from the select options , want pop up java windows user to field in the information.

here there simple form code

<form>
<select>
<option value=“others”>Others</option>
</select>

The field to ask where do you hear about us? I have list of options in there but when the user select “others” i want to input filed popup and want user to filed in the info.

Any advice on the javascript?

Thanks,
Sam

Hey Ruj, just wanted thanks you for your help.
Just being busy. Thanks for the advice. It kind of give me the right direction.

If you want popup window then you need extra work to transfer the value from pop up window to your parent window. Rather you can use prompt() JavaScript method instead. I don’t know what type of pop up window you want, if you want a window itself then you need to open with a different file with window.open(‘filename.html’,‘NewWindow’, ‘’) as far as I know. But whatever you do at least you should have a field (hidden or visible text box) to store the entered value for others.

Thx Ruju…

How about pop up window?

Thanks for the help…

Do you want a window to be popped up? Or you just want to appear another text box just next/below the select box? I would just show a text box below the select if others is selected.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="author" content="Raju Gautam" />
	<title>Untitled 1</title>
    <script type="text/javascript">
    window.onload = function(){
        var selBox = document.getElementById('sel');
        selBox.onchange = function(){
            if(this.value == 'others'){
                document.getElementById('divother').style.display = 'block';
            }
            else{
                document.getElementById('divother').style.display = 'none';
            }
        }
    }
    </script>
</head>
<body>
    <form>
    <select name="sel" id="sel">
        <option value="">Select</option>
        <option value="google">Google</option>
        <option value="others">Others</option>
    </select>
    <div id="divother" style="display: none;"><input type="text" name="othertext" id="othertext" size="25" /></div>
</body>
</html>