Jump to content

Calculations from HTML


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

Recommended Posts

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This topic is 8261 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.