cold fusion form: When my dropdown field changes, how do I update a another field that shows the current date/stamp?

I'm thinking this might be a job for Javascript.  Please provide some code examples.  

These two fields will be either inserted or updated into a Microsoft SQL Server 2005 database.

Thanks.
paultran00Asked:
Who is Participating?
 
_agx_Connect With a Mentor Commented:
Yeah, this would be a job for javascript (see below)

BUT .. what is the 2nd field used for in your application?  If it's for anything important, I wouldn't recommend using javascript for the task.  Obviously it can be disabled and time settings vary from one user's locale to another.  For important values, it's better to use the server time.


<script type="text/javascript">
      function updateDate() {
            document.getElementById('otherField').value = new Date();
      }
</script>

<form>
      <select id="myList">
            <option value="1">option 1</option>
            <option value="2">option 2</option>
            <option value="3">option 3</option>
      </select>
      <input type="text" id="otherField">
</form>
0
 
_agx_Connect With a Mentor Commented:
Typo correction. This line:
 <select id="myList">

Should be:
<select id="myList" onChange="updateDate()">
0
 
paultran00Author Commented:
Nice, it's working but it's not in the format that I need.  

Currently, it returns this format:  Wed Aug 25 10:51:56 MST 2010

Can you tell me how to make it this format:  08/25/2010 10:51
0
 
paultran00Author Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.