Author Topic: Reading value from DateTime prompt using Javascript  (Read 1318 times)

Offline horne47789

  • Associate
  • **
  • Posts: 4
  • Forum Citizenship: +0/-0
Reading value from DateTime prompt using Javascript
« on: 08 Mar 2009 07:35:29 pm »
Hi - I want to read the value from a date-time prompt and adjust it if necessary.  I know I can set it using pickerControlxxxx, but I haven't figured out how to read it when the user adjusts the value.  I've been experimenting with getElementsByTagName and can find the object but don't see any attributes which appear to have the currently selected date, nor can I figure out of there is a getDate() method or something similar I can call.

Any and all help is really appreciated.

Damian.

Offline DanSev

  • Full Member
  • ***
  • Posts: 32
  • Forum Citizenship: +0/-0
Re: Reading value from DateTime prompt using Javascript
« Reply #1 on: 19 Mar 2009 12:55:29 pm »
If the date/time prompt (or date prompt) is not set, it would default to current date and 12:00 (Current date as is on your personal client machine, if you select it to change time it'll be current to complete clock settings.)

Here is some code to get to a date prompt (not date/time), it might prove helpful (the prompt name is called 'PromptDate'):
<script>
var dDate = new Date();
//Subtract one month
dDate.setMonth(dDate.getMonth()-1);
//Set to first of Month
dDate.setDate(1);
//setValue adjust current date in prompt
pickerControlPromptDate.setValue(getFormatDate(dDate, 0 , 'YMD'));
</script>

Include this in an html item after the date prompt. This script will assign the first of the previous month as the date ( Date: March 19th prompt would show Feb 1)

Offline Gopinath

  • Community Leader
  • *****
  • Posts: 176
  • Forum Citizenship: +12/-0
Re: Reading value from DateTime prompt using Javascript
« Reply #2 on: 09 Apr 2009 03:19:36 am »
Try placing the date prompt parameter in a query as a data item, Create a hidden value prompt and assign the query to it. Set the parameter data item as USE and DISPLAY value. Now try reading the value of the hidden prompt using javascript.