I have this Javascript datastore which is part of a TiddlyWiki (fyi) for storing product by SKU. However I’m not sure how to make a form to update it. I want the form to retrieve the amount of the product in ID that is available using GetAmount. The user is given the option to add to, subtract from, or update the value, and then it saves it using the Update function. The new amount should also be displayed in the amount field. This seems like it should be simple, but I don’t know enough about HTML forms to know how to do it.
Here is a fiddle with what I have so far. http://jsfiddle.net/Arlen22/pCDx3/
Forget about using html forms to submit your data. Your datasource is connected directy to your javascript so you can skip the postback and codebehind stuff. I would use jQuery for simplicity but you could do it with native javascript as well. jQuery is well documented if you decide to learn and use it, and worth the time to learn if you ask me.
This example should help to get you started, feel free to edit and comment on it as needed:
Html
Javascript
NOTE: You would want a button or an event that calls the RenderAmount() functions when an id has been entered/changed in the id textbox. In my example i pretended it was already filled in.
By the way, seems like a fun project you have gotten your hands on. Enjoy it! 🙂