473,396 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Value entered in text box appears automatically in combo box (or text box)

106 100+
i'm new to ajax and i have a simple text box and a combo box and i need whenever the user enters a text in the text box that value appears at the combo box or whatever field( another text box maybe )
Nov 3 '08 #1
4 2066
RamananKalirajan
608 512MB
Do u really want to do this thing with AJAX, u can achieve this task wothout AJAX.

[HTML] <html>
<head>
<script type="text/javascript">
function doThis()
{

var x = document.getElementById('myText').value;
if(x==""||x==null||x==false)
{
alert("Please Enter the Value in the Text Field");
document.getElementById('myText').focus;
}
else
{
document.getElementById('mySelect').add(new Option(x,x));
}
}
</script>
</head>
<body>
Enter Text: <input type="text" id="myText" name="myText">
&nbsp;&nbsp;&nbsp;
<input type="button" value="Add to Combo" onclick="doThis()">
<br/><br/>
<select id="mySelect" name="mySelect">
<option>Select</select>
</select>
</body>
</html>[/HTML]

If u want to do it with Ajax, post the code what u have tried. I will try to help u out

Regards
Ramanan Kalirajan
Nov 4 '08 #2
acoder
16,027 Expert Mod 8TB
jessy, I have changed your thread title.

Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Moderator.
Nov 4 '08 #3
jessy
106 100+
Thanks alot for you reply .. did what u said although i was trying to try something new (like ajax) but anyway, now i need when this value is added to the combo box the old option which is ( no data added ) be removed from the combo box
here's my trial :

Expand|Select|Wrap|Line Numbers
  1. var opt= document.getElementById("no");
  2.          opt.remove(0);
where "no" is the name of the option i want to remove not the name of the select statement
Nov 4 '08 #4
RamananKalirajan
608 512MB
Thanks alot for you reply .. did what u said although i was trying to try something new (like ajax) but anyway, now i need when this value is added to the combo box the old option which is ( no data added ) be removed from the combo box
here's my trial :

Expand|Select|Wrap|Line Numbers
  1. var opt= document.getElementById("no");
  2.          opt.remove(0);
where "no" is the name of the option i want to remove not the name of the select statement

Removing u can do easily

[HTML] var sel = document.getElementById('mySelect').selectedIndex;
document.getElementById('mySelect').remove(sel);[/HTML]

This piece of code will do the work what u are aiming at.

Regards
Ramanan Kalirajan
Nov 5 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: godber | last post by:
I need to populate text boxes for instance with employee information using their unique employee works number selected from a combo box. Can anyone help, I am told thru visual basic this can be...
1
by: Zachary | last post by:
Hi I am developing web page using asp.net with c# coding. I would like to know how can i get the value of repeat same id name text box item in my aspx web page Let say i have textbox name ...
4
by: Mark L. Breen | last post by:
Hello Guys and Galls, I use combos on my forms. The code to initialise the combos is as follows Dim dsPIDTypes As DataSet dsPIDTypes = PartDB.GetPIDTypes ' Returns a dataset object...
6
by: MLH | last post by:
Using A97. Want to examine 17-char VIN entered by user. VIN codes are alphanumeric and do not contain Oh's to prevent the confusion that could result if zeros were misread as O's or o's. So, if...
6
by: bammo | last post by:
MS Access 2003, Windows XP SP2, VBA I have a continuous form that allows edits and filters, but not deletions or additions. I filter the form based on combining selections the user makes in...
0
Krishna Ladwa
by: Krishna Ladwa | last post by:
In Sql Server 2000 Version, I found that no Notification message box appears when converting text column to varchar but the data gets truncated to the given size for the varchar. Whereas it appears...
2
by: metalheadstorm | last post by:
Ok this is my first post, gtz me ^^ well i have a DB im making for a project and im using a Vb interface and a access db linking them togethering using ADO. on one SStab / form i have a...
1
by: bytenut | last post by:
I would like to display two field values in a combo after selecting from the list items... i.e. my drop-down shows two fields from a lookup, but when I select the item, only the first field value is...
5
by: peachdot | last post by:
hi, How do i display text that a user entered in textbox as a display label? Basically,i just want to display it as a summary of the choices made.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.