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

Calculations from HTML

Featured Replies

ok... here's the situation: Want to set up an inventory page and have it interact with the inventory database. In the database is a number formatted field containing the current number of an item in stock. Wondered if/how you could change this number (simple adding or subtracting by one) from an html page. Want to have it so that when a person clicks on a link, it subtracts one item from the field. Thanks for any help!

quote:

Originally posted by billiam02:

ok... here's the situation: Want to set up an inventory page and have it interact with the inventory database. In the database is a number formatted field containing the current number of an item in stock. Wondered if/how you could change this number (simple adding or subtracting by one) from an html page. Want to have it so that when a person clicks on a link, it subtracts one item from the field. Thanks for any help!

Do you want to change in database or on web page?

You can post fields to database via HTML FORM.

Change on page can be done with JavaScript.

When you post a question here everyone assumes you are not using Instant. Everyone also assumes you have the cdml reference.fp5 and are using it.

Everyone also assumes you are a Developer. That means you have tried something and it is not working entirely correctly. Give us your code which is causing the problem.

[ December 10, 2001: Message edited by: Keith M. Davie ]

  • Author

quote:

When you post a question here everyone assumes you are not using Instant. Everyone also assumes you have the cdml reference.fp5 and are using it. Everyone also assumes you are a Developer. That means you have tried something and it is not working entirely correctly. Give us your code which is causing the problem.

I'm sorry that I have wasted soo much of your time keith

I would like to change it in the database as well

quote:

when a person clicks on a link, it subtracts one item from the field

Something to be aware of regarding the web interface: it is stateless. That is, it doesn't remember what's going on. It's a different beast from the FMP client.

One way of doing what you want is to make a calculation field in the datbase that's just (field-1). Sumbitting the web form just edits the record and inserts this value into the field. But there is a problem, and a major one at that: if person A browses the page the field value might be 10 (and the submitted value will be 9). Lets say Person A spends five minutes before submitting the form to update the record... in that time five others might have updated the record so the true field value is now 5. When person A submits the form it'll force the value back to 9 because that's what is in their form.

There is no way around the problem because that's the nature of the web. The only way could be to do a quick multi-step update where the form is submitted, the new value is calculated and loaded into a new form, then the new value is auto-submitted again in a matter of seconds. The probability of problems has lessened because the time lag has been reduced from minutes to to seconds, but technically there is still the possibility that near-simultaneous requests will cause problems.

This is one instance where the limitations of thr web interface is serious enough that I'd look at doing it through the FMP client -- unless I could come up with a more robust and reliable method. A script might be useful here but that's another can of worms, introducing another set of problems itself.

All true, but what about [FMP-CurrentModID]? That could help a bit?

Ha! I knew somebody would come up with a solution!

It'll take a bit of coding but it'll certainly be robust and reliable. (It's only in FMP 5.0 and above though.)

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

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.