Hi,
I know I could delete collected info from database collect in editor mode, but is there are way to delete submitted data right after I log/display it on the page through codes? Mainly 2 questions,
- Can I reference a specific roll of data and delete it after I leave the page or right after I display/log it?
- Can I take data from an user input box and use that data directly without submitting and not having to put it in a database?
If these are possible please let me know how.
Thanks.
You might want to consider using the wix-storage API . You can use the data for a user session, or keep it persisted until you clear the storage. This way you don’t need to use a database collection.
I see, thank you so much!
I been able to get it to work by attaching it this an on click button, but it does not work when I put it in onReady.
import {session} from ‘wix-storage’;
…
session.setItem(‘productWidth’,$w(‘#productWidth’).value);
session.setItem(‘productHeight’,$w(‘#productHeight’).value);
var width = session.getItem(“productWidth”);
var height = session.getItem(“productHeight”);
console.log("Width is " + width + " and Height is " + height);
Is there are way to make it check if the user input is enter actively or run only if the user input is entered?
The onReady() function is only run when the page becomes ready.
If you want to catch input, then you’ll need to use the onKeyPress() event handler of the input field. See the post Give the TextInput onKeyPress Function some time for information on ensuring that the input field has been updated before trying to retrieve the value.