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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:32:27+00:00 2026-06-11T17:32:27+00:00

I have a form where users enter some text manually. Then I’d like to

  • 0

I have a form where users enter some text manually. Then I’d like to let the users choose a tag from a database through AJAX, not unlike how tag suggestions appear in the SO question form. While the div where the ajax call places the tag is inside the form, it does not seem to register and the tag is not picked up by the form. Am I missing something in my code, is this impossible or, if impossible there a better way to do this? Thanks for any suggestions.

Here is code:

html

<form method="post" action="enterdata.php">
<input type="text" name="text">Enter text here.
<div id="inserttags"></div><a href="javascript:void(0);" onclick="getTags()";>Get tags</a>
<form type="button" name="submit" value="Enter Text and Tag">
</form>

javascript

getTags() { 
various Ajax goes here, then
//following line inserts value into div of html
    document.getElementById("inserttags").innerHTML=xmlhttp.responseText;
// a bit more ajax, then following pulls tag from db 
xmlhttp.open("GET","findtags.php",true);
xmlhttp.send();
} //end function

php

//gettags.php
//first pull tag from db.  Then:
echo 'input type="text" name="tag" value= "html">Enter tag';
//above output gets inserted in div and is visible on page.

Though the above output is visible on page, the form does not seem to pick it up when you click “Enter Text and Tag” to submit the form.

  • 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-11T17:32:29+00:00Added an answer on June 11, 2026 at 5:32 pm

    After more research and much pondering, I don’t think you can do what I wanted to do…use the native html form to capture the javascript output even with the div inside the form. Instead, the way to do this is to capture the text field using javascript and then place it inside a form within the ajax outputted to the browser as a hidden value along with the tags. Then the user submits the form with both the text and tag, not using the original html but rather a button or link in the ajax output. If anyone knows a better way, I stand corrected, but this way will work, and the html form does not seem to recognize the values in the div inserted by javascript.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple HTML Form that allows the user to enter some text
I have a form that lets the user enter in some text. It will
I have a basic form that asks the user to enter some text in
I have a form with a textarea. Users enter a block of text which
On my homepage I have a simple search form. The user can enter some
I have a form, user enters some data then submits. Rather than a popup
I have a form where users can enter the names and emails addresses of
On my domain I have a form workflow where users enter data on one
I have a form that allows users to enter a date of birth: ie:
I have a form that allows me to enter a user into my database.

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.