Solved

Populating a textbox with text in another textbox as a user types AJAX or JS ASP.NET(VB)

Posted on 2014-11-04
3
179 Views
Last Modified: 2014-11-05
I have 3 textboxes names tbEntry1, tbEntry2, and tbResult

I'm looking for a way, hopefully with an AJAX control or possibly javascript, that I can populate tbResult with the results of tbEntry1 and tbEntry2 on the fly in a format something like:

tbEntry1.text & "-" & tbEntry2.text

Is there an AJAX method to do this? Javascript? Better idea?
0
Comment
Question by:Mike Miller
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
Brian Tao earned 500 total points
ID: 40423296
Use javascript since everything is on screen, so that you can avoid unnecessary traffic between the server and your browser.  This should work:
<html>
<head>
<script>
function populate_it(){
  var d = document;
  d.getElementById("tbResult").value = d.getElementById("tbEntry1").value+"-"+d.getElementById("tbEntry2").value;
}
</script>
</head>
<body>
tbEntry1: <input type="text" name="tbEntry1" id="tbEntry1" oninput="populate_it()"><br/>
tbEntry2: <input type="text" name="tbEntry2" id="tbEntry2" oninput="populate_it()"><br/>
tbResult: <input type="text" name="tbResult" id="tbResult">
</body>
</html>

Open in new window

0
 

Author Comment

by:Mike Miller
ID: 40423831
Works like a charm. Thanks!
0
 

Author Comment

by:Mike Miller
ID: 40425584
I've moved the textboxes into a repeater nested in a GridView. Questions on how to change the JS here:

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28551834.html
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question