i need help creating this form that lets users input values and then the page does the arimethic operation on the background and displays the total.
ex User Input * 2.00 then somewhere it displays total
thank you for your help in advance
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Thank you for the reply I will try to get it on the same page
Here is the page I made to do the calculations: https://braphox.wixsite.com/website/enterrp
I made my own form with text boxes. Userinputs, and two buttons.
And this is the code:
// For full API documentation, including code examples, visit http://wix.to/94BuAAs //TODO: write your code here...=RPGoal-CurrentRP //export function switch1_click_1(event, $w) //import {session} from 'wix-storage'; //session.setItem("key", "value"); import wixData from 'wix-data'; export function button1_click_1(event, $w) { <-- this is the first button let toInsert = { "begin": $w("#input1").value , "end": $w("#input2").value, "difference": $w("#input2").value-$w("#input1").value , //<-- this is the calculation }; wixData.insert("UserRP", toInsert) <-- I created a database, remember to set read/write to public. .then( (results) => { <-- I added the fields, begin, end, difference as numbers. let item = results; } ) .catch( (err) => { let errorMsg = err; })}
The second button is linked to a dynamic page that holds the result
Dynamic page:
All this consists of is an input that is linked to the UserRP database to the difference field. Create the input, or textbox, click on the connected database link above the input/textbox field on the right. Select your database and the column holding the calculation.
I am sure there is a way to retrieve this number on the original page if you ask someone here how to query a database and retrieve the calculated value. I would assume calling this query from inside the onClick button (event) will give the current calculated value.
Getting a response seems to be hit or miss. I've been asking this for a couple of days with no response from anyone. Good Luck.
If you do figure out how to retrieve a value from a database please give me a link. I've followed a few examples from the Code Tutorials and only gotten error messages.