Jump to content

This topic is 7960 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

Is there any way to force the correct date format when CDML is written to the HTML page ?

I need to pull a date field out of FM5 in the format dd/mm/yyyy - which is the format it's stored in the database.

however, any leading zeros are being stripped ie 02/02/2003 become 2/2/2003.

Is there any way to force the correct format when CDML is written to the HTML page ?

Dazzjazz

Posted

dazzjazz

There's a whole slew of date-related posts that I cannot remember exactly but I do recall mention that FM date format is dependent upon your own computer's date format... it's not a FM thing (although there were Euro/U.S. issues). Maybe your own computer can be set to store it that way so you don't have to reformat it.

Or maybe you can convert it to a text field and use a calc field to manipulate it to look the way you want. If not, I'm sure someone can help you using JavaScript or something.

Anyone else out there have a lead for dazzjazz?

  • 3 months later...
Posted

hello all

+ Garry!

this:[FMP-Field:myDate,format]

works just fine but is there a way to assign it as the part of the varible in JavaScript.....

if you remember the part:

curr_date = "[FMP-Field:Date,format]";

....

....

document.write(" + curr_date + ")

however, the write part doesn't work?! Is there a trick to this

thank you!

smile.gif

Posted

noting really happens...the doc.write doesn't create any output...the page is opened by noting written.

I can't use just document.write(curr_date) because the string is a bit longer, I just posted the part of it.

here is the entire string:


document.write("<tr><td background='/images/line.jpg' height='22'><strong><a href="#" onclick="showdetails('" + curr_date + "','"+ curr_loc +"');">" + curr_date + "</strong></td><td background='/images/line.jpg' height='22' align='center'>" + loc_qty + "</td><td background='/images/line.jpg' height='22'>&nbsp;$ " + loc_amnt + "</td></tr>");

the problem/issue starts arround that showdetails(...

maybe you can help...

thank you sir!

Posted

just wanted to keep the post going...I am still looking for an answer to this JavaScript issue!

Any gurus outhere?

Posted

When you view the source of the page, after it is loaded into the browser, what does this look like:

curr_date = "[FMP-Field:Date,format]"

Does it look like this:

curr_date = "Apr 8 2003" (or something similar)

Good Luck.

Garry

Posted

Here is a "hard-wired" version which works:

<html lang="en">

<head>

	<title>test3</title>

	<meta name="generator" content="BBEdit 7.0.3">

	<script>

	function showdetails(currdate,currloc)

		{

		alert(currdate + "<br>" + currloc);

		};

	</script>

</head>

<body>Loading...

<table>

<script>

curr_date = "Thu,Dec 25,1997";

curr_loc = "Anywhere";

loc_qty = 200;

loc_amnt = 1000;

document.write("<tr><td height='22'><strong><a href="#" onclick="showdetails('" + curr_date + "','"+ curr_loc +"');">" + curr_date + "</strong></td><td height='22' align='center'>" + loc_qty + "</td><td height='22'>&nbsp;$ " + loc_amnt + "</td></tr>");

</script>

</table></body>

</html>

Good Luck.

Garry

Posted

so in other words...it should work the same with JS loop.

Ok, thank you Garry

... I will "comb" my code for errors.

laugh.gif

Posted

should = does not

I don't know what to say...If I change

curr_date = "[FMP-Field:Date]";

to

curr_date = "[FMP-Field:Date,format]";

none of the document.write statements work/get executed....remove the format part and all is OK!?

I can get it to work under "normal" circumstances such as

form/inline --> submit-->results:

[FMP-Record]

[FMP-Field:Date,format]

[/FMP-Record]

one of those things.....I guess frown.gif

Posted

My Golden Rule: If something doesn't work on web, create calculation text field with required output. It works in all web situation from WC to Lasso.

Posted

no Lasso for me....[FMP-Record:my boss does not want to pay for nothing...why do you think his netadmin is doing webdesign]

smile.gif

Posted

So if contributors to these forums no longer provide you with free help which results in you spending greater time to accomplish the things you post about, will your boss gain a better understanding of economics or fire you and hire someone even cheaper, albeit less knowledgeable?

We all understand that your boss won't (can't) do the job. laugh.gif

Posted

I sometimes use the Calculated field method for formating data. You can also use Javascript. Here is some code I use for testing date formatting:

<body><script>

[FMP-Record]

mydate = "[FMP-Field:last_app]".split("/");

myday = mydate[0];

mymonth = mydate[1];

myyear = mydate[2];

testdate = new Date("[FMP-Field:last_app]");

document.write("Day is " + myday + " Month is " + mymonth + " Year is " + myyear + "<br>");

document.write("My date is " + testdate.toLocaleString() + "<br>");

[/FMP-Record]</script>

</body>

Hope this is of interest.

Garry

Posted

UNABLE:

yeah...I wish he just hired FM programmer at the begining of FM saga.

In that case all I would worry about is opnening the ports and running backups cool.gif

but then again I would have never joined this forum...met bunch of nice people...and above all learned something new in life (easy or the hard way) which is why I raised my hand for the job in the first place! grin.gif

p.s. forum is MY tool not his...

This topic is 7960 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.