close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

changing values in date picker

Thread began 6/03/2013 1:07 pm by bryan107833 | Last modified 6/03/2013 1:47 pm by Jason Byrnes | 327 views | 1 replies |

bryan107833

Ahh, when I went to update the post it erased the first post....

I am using a date picker on a form for webervations and I need to know how to get the date into the necessary format of "zday", "zmonth" and "zyear". Form code is below:

<div class="cellform">Arrival date</div>
<form method="post" action="http://www.webervations.com/magic-scripts/resbook.asp" target="_blank" name="form1" id="room-reservation-form">
<div class="cellform">
<input id="datepicker_1" name="Date" type="text" />
</div>
<div class="cellform">Nights?</div>
<div class="cellform">
<select name="zlength">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
</select></div>
<input type="hidden" name="zday" id="zday" value="" />
<input type="hidden" name="zmonth" id="zmonth" value="" />
<input type="hidden" name="zyear" id="zyear" value="" />
<input type="hidden" name="showit" value="Y">
<input type="hidden" name="cbp" value="">
<input type="hidden" name="zcaller" value="xxx">
<input type="hidden" name="memberid" value="xxx">

<div class="cellform"><input name="Submit" value="Check Availability" type="submit"></div>

Here is the related javascripts:

</script>
<link type="text/css" href="webassist/datepicker/about_datepicker_1/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="webassist/jquery/jquery.js"></script>
<script type="text/javascript" src="webassist/jquery/jquery-ui.js"></script>
<script type="text/javascript">
$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'mm/dd/yy',
showAnim: 'fade',
onClose: closeDatePicker_datepicker_1
});
});
function closeDatePicker_datepicker_1() {
var tElm = $('#datepicker_1');
if (typeof datepicker_1_Spry != null && typeof datepicker_1_Spry != "undefined" && Date_Spry.validate) {
datepicker_1_Spry.validate();
}
var docElm = document.getElementById("datepicker_1");
var tBlur = docElm.getAttribute("onBlur");
if (!tBlur) tBlur = docElm.getAttribute("onblur");
if (!tBlur) tBlur = docElm.getAttribute("ONBLUR");
if (tBlur) {
tBlur = String(tBlur).replace(/\bthis\b/g, "docElm");
eval(tBlur);
}
}
</script>
<script type="text/javascript">

//Current date in form script
//By Lee Hinder (lee.hinder@ntlworld.com)
//Visit http://javascriptkit.com for this script and more
//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape
//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
var DaysInMonth = 31;
if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))
DaysInMonth = 28;
if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))
DaysInMonth = 29;
return DaysInMonth;
}
//function to change the available days in a months
function ChangeOptionDays(Which)
{
DaysObject = eval("document.Form1." + "zday");
MonthObject = eval("document.Form1." + "zmonth");
YearObject = eval("document.Form1." + "zyear");
Month = MonthObject[MonthObject.selectedIndex].text;
Year = YearObject[YearObject.selectedIndex].text;
DaysForThisSelection = DaysInMonth(Month, Year);
CurrentDaysInSelection = DaysObject.length;
if (CurrentDaysInSelection > DaysForThisSelection)
{
for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
{
DaysObject.options[DaysObject.options.length - 1] = null
}
}
if (DaysForThisSelection > CurrentDaysInSelection)
{
for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
{
NewOption = new Option(DaysObject.options.length + 1);
DaysObject.add(NewOption);
}
}
if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}
//function to set options to today
function SetToToday(Which)
{
DaysObject = eval("document.Form1." + "zday");
MonthObject = eval("document.Form1." + "zmonth");
YearObject = eval("document.Form1." + "zyear");
YearObject[0].selected = true;
MonthObject[NowMonth].selected = true;
ChangeOptionDays(Which);
DaysObject[NowDay-1].selected = true;
}
//function to write option years plus x
function WriteYearOptions(YearsAhead)
{
line = "";
for (i=0; i<YearsAhead; i++)
{
line += "<OPTION>";
line += NowYear + i;
}
return line;
}

</script>

Sign in to reply to this post

Jason ByrnesWebAssist

the format is controlled by this line:
dateFormat: 'mm/dd/yy',


change that to:
dateFormat: 'dd/mm/yy',

to use day month year format.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...