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

The Archive Base Latest Questions

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

i have the following html code : <FORM name=frmmail> <input id=dochtmlContent type=hidden name=dochtmlContent value=oldValue/>

  • 0

i have the following html code :

 <FORM name=frmmail>
 <input id="dochtmlContent" type="hidden" name="dochtmlContent" value="oldValue"/>
 <script>document.dochtmlContent="newValue"</script>
 </FORM>

and later on in a javascript function (which is called upn submit):

     alert(document.dochtmlContent);
     document.frmmail.method = "post";
     document.frmmail.ENCTYPE = "application/x-www-form-urlencoded";
     document.frmmail.action = "/myServlet"; 
     document.frmmail.submit();

Basically, I am declaring a hiden variable, changing its value and submitting it.
The issue is, while I see an alert box displaying “newValue”, when I submit it, my servlet recieves the “oldValue” for the dochtmlContent parameter.

Can someone suggest whats wrong here.

  • 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-14T20:28:27+00:00Added an answer on May 14, 2026 at 8:28 pm

    Change your HTML to this:

    <script>document.getElementById("dochtmlContent").value = "newValue";</script>
    

    The reason is dochtmlContent as a hidden input is not a property of document. That’s not how you want to access it. Instead you are creating that property on document, but the form is still posting the hidden input, unmodified. You need to select that element using the getElementById (or another selector if relevant).

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

Sidebar

Related Questions

I have the following html code: <form> <table> <tbody> <tr> <td> <span>Quantity<span class=pull-right>3</span> <input
I have the following code. def add_resume_link(name, form) link_to_function name do |page| html =
I have the following Javascript code: function checkIfValid(){ var form = document.createuserform; if(form.fName.value ==
I have the following code that generates my form on my html page <input
I have something like this HTML structure : <form name=myvalue id=hello> <input type=text name=name
Here's the deal I have HTML code like this <form action=/test.php> First name: <input
I have the following HTML code for dialog box: <div id=modal-dialog class=no-display> <div class=form>
I have an HTML form using dojo and have the following code for a
I have the following code: index.html <HTML> <HEAD> <TITLE>My App</TITLE> <LINK rel=stylesheet type=text/css href=style.css>
I have the following html code: I saw that for Watir-webdriver the Watir::Image.file_size method

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.