Hello,
I have two pages with two buttons. One page works fine and onClick event fires properly. On other page, for same code (with different fields), onClick event is not firing. Any help? My website is https://psaraph.wixsite.com/pb-jam and here is my code:
//Step 5: Once changes are made using input boxes, update the Collection “USER_INFO” for those changes only when the user clicks Submit button
export function SubmitPrivateData_click() {
let user=wixUsers.currentUser
let userId=user.id
console.log( "Click function activated for: " , userId);
console.log( "Slider position detected at: " , $w( “#slider1” ).value);
$w( “#SubPvtData” ).onClick( (event) => {
// Step 5.1: Get the relevant item from USER_INFO collection
wixData.get( “USER_INFO” , userId)
.then( (item) => {
console.log( "Item secured for user: " , userId);
// Step 5.2: Update those fields in the retrieved item that are linked to the input boxes on this page
item.facetOneInitialAssessment=$w( “#slider1” ).value;
console.log( "Facet One Initial Assessment to-be: " , item.facetOneInitialAssessment);
//Step 5.3: Use update command to put values from input boxes back into USER_INFO collection
wixData.update( “USER_INFO” , item);
} )
. catch ( (err) => {
let errorMsg = err;
console.log( "Uh-oh, something went wrong while retrieving " , userId);
} )
} )
console.log( "onClick event not triggered for " , userId);
}
On Console Log, I see the following:
10:51:14.927 Facet One Initial Assessment as-is: 2 wixcode-worker.js:18:57124
10:51:21.223 Click function activated for: a8bde347-c9b5-4bfd-8d15-16c764bf58cf wixcode-worker.js:18:57124
10:51:21.224 Slider position detected at: 9 wixcode-worker.js:18:57124
10:51:21.225 onClick event not triggered for a8bde347-c9b5-4bfd-8d15-16c764bf58cf wixcode-worker.js:18:57124
Which makes me think that my onClick event is not firing… question is why?