Hi guys I’ve tried to use a read and write dataset which the elements are all connected up to, however most of them are set to be required, which when viewing the page with no information in the elements they are all been shown in red and error boxes! How can I fix this I’ve tried code using cookies, etc but couldn’t get it to work thanks
(Edit) so i managed to find a solution to the problem, when clicking a back button to a previous page and getting all the submitted data from the database to be pre filled in! instead of having every required element shown in red error boxes! i used 2 datasets one set to write only, 2nd dataset is (Read & write) which is connected to a duplicated collapsed box containing all the same elements that are connected to the write only dataset, also 2 submit buttons one connected to a write only dataset which is visible! second one will be collapsed connected to the read/write dataset!
This is the code for the first page
$w.onReady(() => {
let query = wixLocation.query;
if (query.previous === 'true') {
$w('#firstApplicationBox').collapse();
$w('#secondApplicationBox').expand();
$w('#nextStep2').expand();
$w('#nextStep').collapse()
}
});
this is the submit button with a url query attached to the end of the weblink pointing to the next page
mysite.com/hiretrades/business-info?previous2=true
second page code
$w.onReady(function () {
let query = wixLocation.query;
if (query.previous2 === 'true') {
$w("#dataset3").onReady(() => {
var item = $w("#dataset3").getCurrentItem();
if (item["traderBusinessName"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["numberOfEmployees"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["workArea"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["qualifications"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["yearsOfExperience"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["businessType"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["aboutUser"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
if (item["skillsExperience"] === undefined){$w("#secondStepBox").collapse(); $w("#firstStepBox").expand(); $w("#nextStep").expand(); $w('#nextStep2').collapse();}
else {$w("#secondStepBox").expand(); $w("#firstStepBox").collapse(); $w("#nextStep").collapse(); $w('#nextStep2').expand();
}
})}});
with a previous button pointing back to the first page and url query at the end,
so when navigating back to the first page and (previous= true) it will expand the submit button/Box containing all the elements linked to the Read & write dataset and collapse the box with elements linked to the write only dataset, which now should have data already pre filled in if information was submitted to a database during the first page step