By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

Drop Down Box

P: n/a
This is really a html question but I'm posting it here because it's
related to a php site I'm developing.

I'd like to have a drop-down box (or 'combo box' as it's called in
visual basic) that allows the user to either select from the list *or*
type in whatever other value they desire. In VB and VBA this is referred
to as a Limit to List property.

Is there an equivalent form object in html?

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 04 Dec 2003 11:55:58 -0800, bonehead <se**********@here.org> wrote:
This is really a html question but I'm posting it here because it's
related to a php site I'm developing.

I'd like to have a drop-down box (or 'combo box' as it's called in
visual basic) that allows the user to either select from the list *or*
type in whatever other value they desire. In VB and VBA this is referred
to as a Limit to List property.

Is there an equivalent form object in html?


No; closest you'll get in HTML is a <select> and a separate <input
type="text">.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2

P: n/a


"bonehead" <se**********@here.org> wrote in message
news:3F**************@here.org...
This is really a html question but I'm posting it here because it's
related to a php site I'm developing.

I'd like to have a drop-down box (or 'combo box' as it's called in
visual basic) that allows the user to either select from the list *or*
type in whatever other value they desire. In VB and VBA this is referred
to as a Limit to List property.

Is there an equivalent form object in html?


since it's php it would not be hard to create a little selectAdd function
that creates your <select> and your <input type>

I know it would not be hard 'cause I did it for a site recently. My code,
however, depends on my personal data modeling conventions, so it probably
wouldn't be useful to you. Here are the juicy bits

$query = "select * from $tableName .....

while ($myrow = mysql_fetch_array($ ..... {

echo "<option value=$myrow[0] $selectedVar>";

echo $displayFieldContent; //this is set by an argument to my function,
basically contains another row

echo "</option>\n";

}

echo "</select>";

echo "<br>Or add: ";
echo "<input type=text name=Adding".$entityName.">";
Then my <action> checks for a var named "Adding%" and if it finds one it
does the insert, then puts the mysql_insert_id() into whatever table the
form addresses.
Jul 17 '05 #3

P: n/a
Nope. You can do something like this to kinda mimick the behavior:

<select id="something" onchange="Change(this)" style="width: 200px">
<option id="1">Item 1</option>
<option id="2">Item 2</option>
<option id="-1">Other...</option>
</select>
<input id="something_text" type="text" style="display: none; width: 200px">
<script>

function Change(select) {
if(select.selectedIndex == select.options.length - 1) {
select.style.display = 'none';
var edit = document.getElementById(select.id + '_text');
edit.style.display = '';
edit.focus();
}
}

</script>

When Other is selected, the selection box becomes an edit field. You'll need
something to bring the list back, of course.

Uzytkownik "bonehead" <se**********@here.org> napisal w wiadomosci
news:3F**************@here.org...
This is really a html question but I'm posting it here because it's
related to a php site I'm developing.

I'd like to have a drop-down box (or 'combo box' as it's called in
visual basic) that allows the user to either select from the list *or*
type in whatever other value they desire. In VB and VBA this is referred
to as a Limit to List property.

Is there an equivalent form object in html?

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.