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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:34:17+00:00 2026-05-22T02:34:17+00:00

I have a web page with an input field (a calendar to select a

  • 0

I have a web page with an input field (a calendar to select a date from).
The problem is that I need to read that input field from 2 different form elements that each have their own action and other values.

|calendar|   [do this]   [do that]

I don’t want to copy the input field in both forms since it would look silly.
Any suggestions?

Edit: here’s the two forms:

<form action="/adm/user/credit/update?sms=<?=$id?>&user=<?=$user?>" method="post">
    <input type="hidden" name="isPaid" value="1"/>
    <label for="datums">Datums: </label>
    <input type="text" id="datums" name="datums"/>
    <input type="submit" value="Paid" style="background-color:green; color:white"/>
</form>
<form action="/adm/user/credit/extend?sms=<?=$id?>&user=<?=$user?>" method="post">
    <input type="hidden" name="phone" value="<?=$phone?>">
    <select name="period">
        <option value="7">7</option>
        <option value="14">14</option>
        <option value="30">30</option>
    </select> days
    <input type="submit" value="Extend" style="background-color: blue; color: white">
</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-05-22T02:34:18+00:00Added an answer on May 22, 2026 at 2:34 am

    Just give it unique ID and use document.getElementById like this anywhere you want:

    var myValue = document.getElementById("myInputID").value;
    

    This way it doesn’t matter where the input is located, it can even be outiside of any form.

    Edit:
    To read the value upon submit, first add the onsubmit part to the relevant form:

    <form action="....." onsubmit="ReadValue(this);">
    

    And now have this in your page:

    <script type="text/javascript">
    function ReadValue(oForm) {
       var myValue = document.getElementById("myInputID").value;
       alert("value is: " + myValue);
    }
    </script>
    

    This will show the value as alert dialog.. if you want to populate hidden form field with the value, have such code instead:

    function ReadValue(oForm) {
       var myValue = document.getElementById("myInputID").value;
       oForm.elements["myHiddenFieldId"].value = myValue;
    }
    

    Hope it’s clear enough! 🙂

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

Sidebar

Related Questions

You have a web page with a form that has an input field of
I have a web page where it will input an excel/CSV file from the
I have an <input> field in my web page, and I want to add
I am creating a web page where I have an input text field in
On that web page I have input fields that use the Mike Taylor html5
Suppose I have an input field in a web page with charset UTF8 ;
I have a web form that includes a file input (for a photo) and
I have this text input field on a web page. User types in item
I have a web page that includes a bunch of images. Sometimes the image
I have a web page which contains a select box. When I open a

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.