Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Newbies

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

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?

Try:

[FMP-Field:myDate,format]

Good Luck

Garry

  • 3 months later...

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

What happens when you try this:

document.write(curr_date);

Good Luck.

Garry

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!

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

Any gurus outhere?

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

"Thu,Dec 25,1997"

...I am not quite sure if I can "mix" text and digits like this

Thank you Sir!

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

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

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

I'm just a curious bystander. What would happen if you tried

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

?

good thoguht...no cigar frown.gif

Does, "Format" work with a Date field?

Garry

frown.gif I had no luck so far

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.

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

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

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

this is definetly a "Save As..."

thanx Garry

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...

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.