Click to See Complete Forum and Search --> : Form + anchor


falconia
08-15-2003, 04:16 AM
Clicking on the select link gives me a popup calendar where I choose wanted date, then it's displayed in the field "date1" with the format dd.MM.yyyy. (This works correctly).

<FORM method="post" name="MyForm" id="MyForm" action="MyPage.pgm">

<td>
<SCRIPT LANGUAGE="JavaScript">
var cal1 = new CalendarPopup();</SCRIPT>
<input type="text" name="date1" value="<field name=*WRKFLDS.date1>" size=11 maxlength=10>
</td>
<td>
<a HREF="#" onClick="cal1.select(document.MyForm.date1,'anchor1','dd.MM.yyyy'); return false;" NAME="anchor1" ID="anchor1">
select
</a>
</td>

What I can't figure out is how to display the date in three seperate fields with the formats dd, MM and yyyy.

Hope you understand my question:) Anyone got an idea?

xataku_nakusute
08-15-2003, 04:34 AM
im not quite confident of my answer for i found your question a tad vague....however, if youre trying to display the date in that format, why not just use javascripts built-in date functions?

Khalid Ali
08-15-2003, 08:40 AM
YOu will need to locate the part of the code in your calendar application that actually populates the text filed.and at that point just set as many
document.formName.textfield.value = data;

Thats it..:D

falconia
08-15-2003, 08:46 AM
I was not quite confident with my question either:)

I'll try again:

I do use a javascript with built-in date functions that displays a calender, and then return the picked date.

Where I put 'dd.MM.yyyy' I can type in any date format I like.
(dd/MM/yyyy, ddMM, and so on).

If I pick todays date in the popup calendar it returns;
15.08.2003 (this is one text field)
in the text field date1. This works fine.

But, I'd like to split the date into three different text fields;
15 08 2003 (this is three text fields)

When I put in these text fields, this javascript only updates the first one, and ignores the other two. If I reload the page, the other two fields are filled in.

I'm not a javascript expert, and only use already made scripts where I perform minor changes. So if the option is to do major changes in the script, I'll have to accept the solution I already have (which works just fine).

Khalid Ali
08-15-2003, 08:54 AM
This is what I understood,
You want day in one text field
month in second text field and
yyyy in 3rd text field???

if so then as I said before you will have to have three text fields say t1,t2 and t3 and the form name is form1

now where you have the date object created this si what yo'd do
document.form1.t1 = date.getDate();
document.form1.t2 = date.geMonth()+1;
document.form1.t3 = date.getLongYear();