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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:57:07+00:00 2026-06-12T07:57:07+00:00

I have this code: <html> <head> <script type=text/javascript> /*********************************************** * Drop Down Date select

  • 0

I have this code:

<html>
<head>

<script type="text/javascript">

/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

function populatedropdown(dayfield, monthfield, yearfield){
     var today=new Date()
     var dayfield=document.getElementById(dayfield)
     var monthfield=document.getElementById(monthfield)
     var yearfield=document.getElementById(yearfield)
     for (var i=0; i<31; i++)
         dayfield.options[i]=new Option(i, i+1)
     dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
     for (var m=0; m<12; m++)
         monthfield.options[m]=new Option(monthtext[m], monthtext[m])
     monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
     var thisyear=1920;  // fixed start year of 1900
     var nowyear = 1994;
     var diff = nowyear - thisyear +1; // number of years from 1900
     for (var y=0; y<diff; y++){
         yearfield.options[y]=new Option(thisyear, thisyear)
         thisyear+=1
     }
}
</script>

<script>
function getcombined(){
    var year = document.getElementbyId("yeardropdown").value;
    var month = document.getElementById("monthdropdown").value;
    var day = document.getElementById("daydropdown").value;
    var combineddob = year + "-" + "month" + "-" + day;
    document.getElementById("hidden1").value=combineddob
}
</script>


</head>

<body>
<form action="" name="someform">
<select id="daydropdown" name='day' value="daydropdown">
</select> 
<select id="monthdropdown" name='month' value="monthdropdown">
</select> 
<select id="yeardropdown" name='year'  value="yeardropdown">
</select> 
<input type='hidden' id='hidden1' name='dob' value="" />
<input type='submit' />
</form>

<script type="text/javascript">

window.onload=function(){
    populatedropdown("daydropdown", "monthdropdown", "yeardropdown")
}
</script>


</body>
</html>

I need the <input type='hidden' id='hidden1' name='dob' value='' /> to update to var combineddob when the form is submitted.

I have tried several methods, but I do not know much about javascript so I am not good with these kinds of fixes.

I may be over looking something, but I have not yet figured out what is 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-06-12T07:57:09+00:00Added an answer on June 12, 2026 at 7:57 am

    change your html

    <input type='submit' />
    

    to this

    <input type='submit' id="submitButton" />
    

    and in your script

    window.onload = function(){
        populatedropdown("daydropdown", "monthdropdown", "yeardropdown");
        var submitBtn = document.getElementById("submitButton");
        submitBtn.onsubmit = function(){getcombined();};
    };
    

    This will allow you to run the function in onsubmit when the submit button is clicked. It will in turn call the function getcombined(); and then submit the form.

    EDIT

    Perhaps you should change these two lines:

    var combineddob = year + "-" + "month" + "-" + day;
    document.getElementById("hidden1").value=combineddob
    

    to

    var combineddob = year + "-" + month + "-" + day;
    document.getElementById("hidden1").value=combineddob;
    

    and

    var year = document.getElementbyId("yeardropdown").value;
    

    to (note that getElementbyId is not a function)

    var year = document.getElementById("yeardropdown").value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK i have this code HTML: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js> </script> <script type=text/javascript>
Ok, I have this code: <html> <head> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script> <script type=text/javascript> function get()
I have this code <html> <head> <script src=jquery-1.7.2.min.js type=text/javascript></script> <script src=jquery-ui-1.8.20.custom.min.js type=text/javascript></script> <script type
I have this html code <html> <head> <title>JQuery Problem 2</title> <script type=text/javascript src=jquery-1.4.min.js></script> <script
Let's have a look at this HTML code: <!DOCTYPE html> <html> <head> <title>Test</title> </head>
I have this HTML code for radios: <input type='radio' name='a_27' value='Yes' id='a_27_0' /> <input
I'm attempting to select all <script type=text/html> tags in a page. I use <script>
I have this two lines of html code... <div id=slider1 data-param1=XXX data-param2=XXX></div> <script src=script.js
i have this html code <table style=width: 100%;> <tr> <td> ID </td> <td> <input
I have this html code that i want to edit with jQuery. Here is

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.