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 8703477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:52:43+00:00 2026-06-13T02:52:43+00:00

I am trying to setup a simple data entry form and I am new

  • 0

I am trying to setup a simple data entry form and I am new to JQUERY. I need to return my database ID of the select autocompleted item in a hidden field. I found the code online to this, but when I added multiple fields to the form, autocomplete worked by changing the reference from ID to a CLASS. But the hidden fields did not.

I believe the issue is that I need to have the specific ID tag name to update the value for the specific hidden field. I was thinking I could do something like get the ID of the current field that is being updated with the autocomplete…that is where I need some help.

$().ready(function() {

    $(".course").autocomplete("get_course_list2.php", {
            width: 360,
            matchContains: true,
            mustMatch: true,
            //minChars: 0,
            //multiple: true,
            //highlight: false,
            //multipleSeparator: ",",
            selectFirst: false
    });

    $(".course").result(function(event, data, formatted) {
            $("#course_val").val(data[1]);
    });
});

Here is the HTML form

<form autocomplete="off">
    <p>
        Course Name <label>:</label>
        <input type="text" name="course1" class="course" id="course1" />
        <input type="hidden" name="course_val1" class=".course_val" id="course_val1" />
    </p>
    <p>
        Course Name <label>:</label>
        <input type="text" name="course2" class="course" id="course2" />
        <input type="hidden" name="course_val2" class=".course_val" id="course_val2 " />
    </p>
    <input type="submit" value="Submit" />
</form>

I would appreciate any help that you could provide.

Thanks
jlimited

  • 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-06-13T02:52:44+00:00Added an answer on June 13, 2026 at 2:52 am

    Here is the solution that I found else where.

    $(".course").result(function(event, data, formatted) {
            $( "#"+$(this).attr("id").replace("course","course_val" )).val(data[1]);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to setup a simple proxy server that we post the data
I am trying to setup a simple database in which I have a user
I'm trying to setup a simple C# form to search one of our SQL
I'm trying to setup a simple timer that gets started from a Rails Application.
In an academic project I'm trying to setup a simple physics engine. I am
I setup a Paypal Sandbox account and am trying to create simple purchases through
I'm trying to make a simple base war which includes all the boilerplate setup
I'm trying to set up a simple chat system with jQuery / Ajax ,
I'm trying to set up a simple SQLite database in Android, handling the schema
In trying to setup a unit test for inserting an item into an SQL

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.