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.

trouble with FMP-CurrentDate

Featured Replies

hello, I want to set the field Date in the database with the value of current date.

<FORM ACTION="FMPro" METHOD="post">

<INPUT TYPE="hidden" NAME="-db" VALUE="Main.fp5">

<INPUT TYPE="hidden" NAME="-lay" VALUE="main">

<INPUT TYPE="hidden" NAME="-format" VALUE="mainmenu.html">

<INPUT TYPE="hidden" NAME="Field1" VALUE="Done">

<INPUT TYPE="hidden" NAME="Date_field" VALUE="[FMP-CurrentDate]">

</FORM>

but I receive the error "your attempt to edit failed because of the following error:" then a scroll bar which I cannot scroll so I cannot read it.

The field Date_field is a date field.

Thanks you,

nati

The form has to be submitted in order to get a result. How about something like:

[FMP-IF: Test .eq. Yes]

<FORM ACTION="FMPro" METHOD="POST" name="TestForm">

<INPUT TYPE="hidden" NAME="-db" VALUE="Main.FP5">

<INPUT TYPE="hidden" NAME="-lay" VALUE="main">

<INPUT TYPE="hidden" NAME="-format" VALUE="finish.htm">

<INPUT TYPE="hidden" NAME="-error" VALUE="searcherr.html">

<INPUT TYPE="hidden" NAME="-RecID" VALUE="[FMP-CurrentRecID]">

<INPUT TYPE="hidden" NAME="-Token" VALUE="[FMP-CurrentRecID]">

<INPUT TYPE="hidden" NAME="-Script" VALUE="Date_SCRIPT">

<INPUT TYPE="image" border="0" name="-edit" src="images/print.gif">

</FORM>

<script>

document.TestForm.submit()

</script>

[FMP-ELSE]

<img src="images/print_2.gif" width="152" height="25">

[/FMP-IF]

Note: I haven't actually tried this, but it's worth a shot.

  • Author

hello bridge,

Yes, I decided to just try the input type instead so I changed the post (so possibly nobody know what you are talking about now!) but this is good idea that I will look at.

thanks,

nati

  • Author

Just another note, if I remove the

<INPUT TYPE="hidden" NAME="Date_field" VALUE="[FMP-CurrentDate]">

then the field Field1 is being set to "Done" and no error message.

thanks,

nati

Nati,

Two ways to do this:

1. Use a script to update the 'date_done' field.

2. Use some Javascript to insert the date into the form.

Here is the Javascript:

This is between the HEAD tags:

<script language="Javascript">

dToday = new Date();

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

</script>


This is in the FORM:

<script>document.write('<input type="hidden" name="date_done" value="' + sToday + '">');</script>


Hope this helps. All the best.

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.