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

does any one know how I can set a FM field on a webpage to the current date? By JS or just using FM?

Thanks

Hal.

It is possible both ways

Easiest is through FM

Create a calculation field for the date Status(CurrentDate)

Place this field on your web page

Javascript is a bit more involved.

Ed.

IMHO -- there is also build-in function in WC and CDML.

There will be difference in execution:

1. JS will have client date

2. CDML will have the date from FMU machine

3. the same will be for the Status method.

CDML -- HTML:


<form>

<input name="Date" type="text" id="Date" tabindex="9" value="[FMP-CurrentDate]" size="15">

</form>

Leb i Sol, I am unfamiliar with some of your code. What is " id="Date" tabindex="9""? Is this something new in FMPro6? I can't find any reference to id or tabindex in my HTML reference. Thanks.

sorry that has nothing to do with FM....

"id" is just a name of the field and "tabindex" sets the order ( HERE )

so could have used:

<form>

<input name="Date" type="text" value="[FMP-CurrentDate]">

</form>

just as well

That tells me a lot. I've learned something. I'm glad I asked.

Thank you.

That tells me a lot. I've learned something. I'm glad I asked.

Thank you.

hmm...do I sense some irony in this post?!

frown.gif well...soooorrrry but this is the simple way of looking at it....follow the link above if u need more in-depth info but really that is all there is to it.It is up to u to use it...it is just a matter of how organized u want to be and how much u care about the code vs. funcitonality....my post/code was a snip soooo that is why it looked odd.

anyway...

No irony was intended. I meant what I wrote.

smile.gif... even better
  • Author

OK... I was not really clear.

I want the user to be able to click a button on the details (edit) page that will set a date field to the current date. I also want them to be able to type in another date if they want to.

I thought a JS attached to a button would be the easiest - just don't know how to do it?

Any ideas would be appreciated.

Cheers

Halbj

There have been some lengthy threads on this (with Javascript). However, they may have been quite some time ago.

In the <body>:

<input type="hidden" name="mydate">



<a href="#" onclick="insDate();">Insert Date</a>








In the <head>:




<script>



function insDate()



   {



   sToday = getDate() + "/" + getMonth() + "/" + getFullYear();







   document.myform.mydate.value = sToday;



   }



</script>

Hope this helps.

Garry

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.