close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Date format issues

Thread began 8/29/2012 1:56 am by keith298718 | Last modified 8/30/2012 10:56 am by Jason Byrnes | 560 views | 3 replies |

keith298718

Date format issues

Hi
I have 2 pages an insert and a results page both generated with data assist wizard. The date picker on the insert page only works when the format is set to mm,dd,yy. I need it to display as dd,mm,yy. I have tried
$(function(){
$('#jdate').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd-mm-y',
onClose: closeDatePicker_jdate
});
But that does not effect the display of the date, I have also tried setting the format in datepicker to dd,mm,yy but this gets an error when trying to insert the record , I have tried editing the insert code

"Customer|Job|Parts_Required|Issues|Location|Tech|Contact|Priority|jdate";
$WA_fieldValuesStr = "".((isset($_POST["Customer"]))?$_POST["Customer"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Job"]))?$_POST["Job"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Parts_Required"]))?$_POST["Parts_Required"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Issues"]))?$_POST["Issues"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Location"]))?$_POST["Location"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Tech"]))?$_POST["Tech"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Contact"]))?$_POST["Contact"]:"") ."" . $WA_AB_Split . "".((isset($_POST["Priority"]))?$_POST["Priority"]:"") ."" . $WA_AB_Split . "".((isset($_POST["jdate"]) && $_POST["jdate"]!="" )?date("Y-m-d H:i:s", strtotime($_POST["jdate"])):"") ."";

But again no success

Its been a while since I have done any web dev work so I am probably missing something very obvious

Please see attached file for full code

Thanks
Keith

Attached Files
agtronics.zip
Sign in to reply to this post

Jason ByrnesWebAssist

there are 2 pieces of code on the insert page that effect the way the date is displayed:

$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'mm/dd/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
});



var jdate_Spry = new Spry.Widget.ValidationTextField("jdate_Spry", "date", {isRequired: false, format:'mm/dd/yyyy', validateOn:["blur"]});



the format needs to be changed in both places.

to use the dd-mm-yyyy format, change those 2 pieces of code to:

$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'dd-mm-yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
});



var jdate_Spry = new Spry.Widget.ValidationTextField("jdate_Spry", "date", {isRequired: false, format:'dd-mm-yyyy', validateOn:["blur"]});




you will also want to change the following code on the resuklts page to change the way it shows there:

php:
<?php echo(($row_WADAcurrent_jobs['jdate'])?date('d/m/Y',strtotime($row_WADAcurrent_jobs['jdate'])):''); ?>




change that to:

php:
<?php echo(($row_WADAcurrent_jobs['jdate'])?date('d-m-Y',strtotime($row_WADAcurrent_jobs['jdate'])):''); ?>
Sign in to reply to this post

keith298718

insert page still not behaving

I changed the code in the insert page and as soon as you leave the date field you get an invalid format message. The date displays correctly.

I am probably missing something else that's obvious

See attached code

Thanks

Keith

Attached Files
current_jobs_insert.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you change the spry validation format to a 2 digit year.

change:

var jdate_Spry = new Spry.Widget.ValidationTextField("jdate_Spry", "date", {isRequired: false, format:'dd-mm-yy', validateOn:["blur"]});



to:

var jdate_Spry = new Spry.Widget.ValidationTextField("jdate_Spry", "date", {isRequired: false, format:'dd-mm-yyyy', validateOn:["blur"]});
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...