NetTalk Central

Author Topic: Date lookup issue: Only @D6, @D2 supported  (Read 4504 times)

vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Date lookup issue: Only @D6, @D2 supported
« on: July 18, 2008, 12:57:12 PM »
(4.31 Pre-Release 7)

I've been tearing my hair out trying to figure out why date lookups were not working in my application, but worked in the example applications, even though all of the form settings matched.  The reason is in the calendar code.

You see, some of my clients wish to use the system's date format (eg. @D17), so the site date format is this instead of @D6.

In All.JS:

// SelectDate
function sd(f,e,p,r,b1,b2){
 ct = document.forms[f].elements[e];
 switch (p){
 case "@D6":
 case "@D06":
  var c = new calendar6(ct);
  break;
 case "@D2":
 case "@D02":
  var c = new calendar2(ct);
  break;
 }

If the calendar cannot match the user's choice, can at least *any" calendar be presented?

Thanks!

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Date lookup issue: Only @D6, @D2 supported
« Reply #1 on: July 18, 2008, 10:04:48 PM »
Vince, I don't know if I can answer your question specifically for the date format you are talking about, but if you look in the NetWeb.tpw file around line 3146, there is a case statement to select the proper calendar2.js or calendar6.js.

Not sure if you can break the code in your app to allow for @d17, but I would think you might be able to tweak the javascript by creating a calendar17.js and working it into your app.
« Last Edit: July 18, 2008, 11:06:55 PM by Mike Grigsby »
Mike Grigsby
Credify Systems
Central Oregon, USA

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Date lookup issue: Only @D6, @D2 supported
« Reply #2 on: July 18, 2008, 11:30:41 PM »
Hi Vince,

Do they want to support the @d17 as it is on the _server_ or the D17 of the _client_ machine?

The JavaScript calendar currently built-in is limited to @d6 or @d2. However typically one of these is right. If you want the date format to match the _client_ then you need to take a slightly different approach.

Of course this limitation is limited to entry fields only - you can use any date picture when displaying a date.

Cheers
Bruce


vsorensen

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
    • Email
Re: Date lookup issue: Only @D6, @D2 supported
« Reply #3 on: July 20, 2008, 08:07:51 PM »
Mike:  My workaround was to format "December 1, 2007" with @D17, see if it was month first or day first, then temporarily replace @D17 with @D6 or @D2 in p_web.site.datepicture.  However, I've realized that this will cause problems in other sessions that are called at the same time.

Bruce:  Presumably whichever shows up on the web page now when @D17 is used, but that is a wrinkle that had not occurred to me.  For the client who requested the original change, I believe both the server and client machines are using DD/MM/YYYY.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Date lookup issue: Only @D6, @D2 supported
« Reply #4 on: July 24, 2008, 12:19:46 AM »
Hi Vince,

My point is that @D17 will always be the Server setting.
You might be able to get the setting from the client using JavaScript (but honestly I doubt it.)

Cheers
Bruce