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

  • SEARCH
  • Home
  • 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 201699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:13:20+00:00 2026-05-11T17:13:20+00:00

and thanks for reading. I am building a data entry form. I am trying

  • 0

and thanks for reading.

I am building a data entry form. I am trying to figure out a way to let the user to provide a criteria (last name for instance), search the employee table for all employees that match the criteria, display the result in a way they can select the correct employee, and pass the the ID of that employee back to the data entry form so they can complete the record and save it.

Thanks

  • 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-11T17:13:20+00:00Added an answer on May 11, 2026 at 5:13 pm

    One way to do this would be with the jQuery autocomplete plugin. Have text box on your form that allows search and a hidden field that stores the id. Use autocomplete via AJAX to get a list of name/id pairs returned as JSON based on the search criteria. Have the autocomplete set up to force selection from the list — which will disallow any non-matching text in the field. When the user selects an item from the list have the result function store the associated id in the hidden field. Use the hidden field on form post to get the ID of the employee.

    It might look something like:

    View

    $('#searchBox').autocomplete( '/Employees/Search', {
        dataType: 'json',
        max: 25,
        minChars: 2,
        cacheLength: 1,
        mustMatch: true,
        formatItem: function(data,i,max,value) {
            return value;
        },
        parse: function(data) {
            var array = new Array();
            for (var i=0; i < data.length; i++) {
                var datum = data[i];
                var display = datum.FirstName + ' ' + datum.LastName;
                array[array.length] = { data: datum, value: display, result: display };
            }
        }
    });
    
    $('#searchBox').result( function(event, data, formatted) {
        if (data) {
           $('#employeeID').val( data.EmployeeID );
        }
    });
    
    $('form').submit( function() {
        if (!$('#employeeID').val()) {
           alert( 'You must select an employee before clicking submit!' );
           return false;
        }
    });
    
    
    <input type='text' id='searchBox' />
    <input type='hidden' id='employeeID' name='employeeID' />
    

    Controller:

    public ActionResult Search( string q, int limit )
    {
        var query = db.Employees.Where( e => e.LastName.StartsWith( q ) )
                                .OrderBy( e => e.LastName )
                                .Select( e => new
                                     {
                                         FirstName = e.FirstName,
                                         LastName = e.LastName,
                                         EmployeeID = e.EmployeeID
                                 });
        if (limit > 0)
        {
            query = query.Take(limit);
        }
    
        return Json( query.ToList() );
    }
    
    public ActionResult SomeAction( int employeeID, ... )
    {
       ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 244k
  • Answers 244k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The general solution is to use windows hooks, filter to… May 13, 2026 at 8:03 am
  • Editorial Team
    Editorial Team added an answer Instead of using Javascript, why don't utilize CSS and make… May 13, 2026 at 8:03 am
  • Editorial Team
    Editorial Team added an answer I believe the pexpect module would be the easiest way… May 13, 2026 at 8:03 am

Related Questions

I'm building an app which is going to have to handle and store a
I am building an indexer application based on a suffix tree, that enables me
I am building a tracking system for refererrals to our websites and on behalf
I am building a Web Application for shopping cart using ASP.NET and I am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.