Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6781867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:40:28+00:00 2026-05-26T16:40:28+00:00

Within an web form I have a some input fields <div id=search1> <div class=forminput>

  • 0

Within an web form I have a some input fields

<div id="search1">
        <div class="forminput">
            Label 1<br />
            <input type="text" name="Field1" value="" size="20" />
        </div>
        <div class="forminput">
            Label 2<br />
            <input type="text" name="Field2" value="" size="20" />
        </div>
</div>

As focus is lost on the control the value entered needs to be returned to an asp.net textbox control. I have been able to pass the values to a div layer or standard html element using the following code:

    function fieldUpdate() {

            var currentValue = $(this).val();
            var field = $(this).attr("name");

                if (currentValue != "") {
                    $("#results").append(field + ":" + currentValue + "+");
                }
        }
 $(function () {
            $("#search1 :input[type=text]").focusout(fieldUpdate);

        });

However this does not seem to work with an asp.net server side control.
Update
The objective of this question is to provision the values entered into standard html input fields into an asp:textbox control

<asp:TextBox ID="results2" Text="" Width="400" runat="server" />

Update
Below is a screenshot of how the current solution works. At the top you see teh input fields as a user enters a value and tabs out of each field this value is added to a Div layer labeled results. What I want to do is instead of adding the fieldname and value to a DIV element I want them to instead be added to a asp:textbox control.

enter image description here

It is preferred to have this code stored within an external js file vs within the aspx page.

Can anyone provide any suggestions on how to accomplish this?

thanks in advance

Update Solution
Thanks to James for helping me work though this. Below is the jQuery code as used in the current implementation.

function fieldUpdate() {

            var currentValue = $(this).val();
            var field = $(this).attr("name");
            var txt = $("#<%=results2.ClientID%>");
                if (currentValue != "") {
                    $("#results").append(field + ":" + currentValue + "+");
                    if (txt) {
                        txt.val(txt.val() + field + ":" + $(this).val() + "+");
                    }
                }
        }


        $(function () {
        //only evaluate input text field
            $("#search1 :input[type=text]").focusout(fieldUpdate);

This will now allow an asp:textbox to be populated with the input field name and value.
Example Field1:foo+Field2:somevalue2+Field3:somevalue3 …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:40:29+00:00Added an answer on May 26, 2026 at 4:40 pm

    Those are not ASP.NET TextBox controls; they’re HTML text inputs. To answer your question though, you would do this:

    <script type="text/javascript">
        $(function(){
            $("#input1").val("Hello world");
        });
    </script>
    <input type="text" id="input1" />
    

    I noticed that you’re setting the name instead of the ID in your example. I would use ID if you have a choice, but you can find an element by name like this:

    $("input[name='Field1']").val("Hello world");
    

    If you use an actual ASP.NET TextBox control, the solution will be a little different:

    <script type="text/javascript">
        $(function(){
            $("#<%=TextBox1.ClientID%>").val("Hello world");
        });
    </script>
    <asp:TextBox ID="TextBox1" runat="server" />
    

    If you want to get all of the text inputs in the search1 div, you can do this:

    $(".forminput input[type='text']").val("Hello world!");
    

    Here’s a jsFiddle for the above example: http://jsfiddle.net/DWYTR/

    EDIT

    Per your comment, here is how you can copy a value from one input to another on blur:

    $(".forminput input[type='text']").blur(function(){
        var txt = $("#<%=TextBox1.ClientID%>");
        if (txt){
            txt.val(txt.val() + $(this).val());
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a complex input form within a PHP based web application. To structure
Within my web application I am using some custom validation for my form fields.
I have an ASP.NET page that has three div s within the only form
I have a form containing a list of input fields that the user populates
I need to pre-fill some form in some web page within my WPF app
I have worked within a web development company where we had our local machines,
I am using Tiles within my web-application. I have a standard-layout (standard.jsp) within the
I use div tags to define areas within my web pages. I set all
I have an ASP.NET web form that has a container usercontrol that hosts several
I have stored some files in the form of blobs on azure and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.