Solved

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

Posted on 2010-08-24
4
258 Views
Last Modified: 2012-05-10
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.
0
Comment
Question by:paultran00
  • 2
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 50 total points
ID: 33514145
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
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 50 total points
ID: 33514157
Typo correction. This line:
 <select id="myList">

Should be:
<select id="myList" onChange="updateDate()">
0
 

Author Comment

by:paultran00
ID: 33524277
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
 

Author Comment

by:paultran00
ID: 33524368
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Select - Help finding duplicate records 5 23
sql server cross db update 2 21
access to sql migration 5 25
Specify timing interval fro change data 2 57
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question