?
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
Medium Priority
?
262 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 200 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 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

757 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