Forms Save Progress
Save progress of a form to continue later for submission.

All Snippets
Allows a user to save progress of a form and continue filling the form at another time. Currently, this snippet only works for logged-in members. The values are tempoirarily saved to a collection that you have to create.
Create a collection with 2 columns
Key as type Text
Value as type Object
Set the permissions of the collection to Member-generated
Notes:
Only works with custom forms and old forms.
Does not work with new wix forms.
Values of fields are saved based on ids of form elments. So, if the ids of fields are changed, the saved values will not load for those elements.
New to our site? Please see our quick tutorial on how to work with our snippets
Setting | Description |
---|---|
$w.onReady(() => {
FormSave({
buttonSaveId: '#buttonSave',
collectionId: 'KeyValueCollection',
fieldIds: ['key', 'value'],
elementSuccessId: '',
elementFailId: '',
messageTimeout: 3 // seconds
})
})
async function FormSave({buttonSaveId:e,collectionId:n,fieldIds:t,elementSuccessId:i="",elementFailId:o="",messageTimeout:a=3,readOnly:r=!1,manualLoad:c=!1}){
if(!e||!t||!n)return;const s=$w(e);if(!s?.id)return;const d=$w(i),u=$w(o)
;let l,m
;const w=$w("TextInput, TextBox, RichTextBox, RadioButtonGroup, CheckboxGroup, Dropdown, SelectionTags, Slider, DatePicker, RatingsInput, AddressInput, Switch")
;s.onClick((async function(){
const e=w.reduce(((e,n)=>(e[n.id]=n.value,e)),{}),i={_id:m?._id,[t[0]]:l,value:e
};try{await f.save(n,i),d?.id&&b(d)}catch(e){console.error(e),u?.id&&b(o)}}))
;const f=require("wix-data"),{authentication:x}=require("wix-members-frontend")
;async function h(e){const{items:i}=await f.query(n).eq(t[0],e).find()
;if(console.log("items",i),!i.length)return;m=i[0];const o=m.value
;w.forEach((e=>{e.value=o[e.id],r&&(e.readOnly=!0)}))}function b(e){
e.show(),e.expand(),setTimeout((()=>{e.hide(),e.collapse()}),1e3*a)}
async function p(){
const{currentMember:e}=require("wix-members-frontend"),n=await e.getMember()
;n&&!r?(l=n._id,s.enable(),c||await h(l)):s.disable()}return p(),x.onLogin(p),{
load:h}}

Title

Title