form data not saving after logging out

By: SYDNEY CARRICO | Asked: 11/05/2024
ForumsCategory: Code Helpform data not saving after logging out
SYDNEY CARRICO asked 2 months ago
I have coded a stopwatch that I want my users to see the last time entry for it every time they access this stopwatch. I created a field in formidable forms to "hold" the last entry and the form works perfectly. When I'm logged in. I can access it multiple times and I always see my last entry. However, if I log out and log back in the field is empty. I've checked all the settings for logged in only status and don't see any. This is a user id specific form. Any suggestions on how I can get that last entry field to stay even when a user logs out?
Code:
Stopwatch
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: 'Fredericka the Great', cursive;
background-color: #f0f0f0;
text-align: center;
}
#stopwatch {
font-size: 64px;
}
button {
font-family: 'Courier New', monospace;
font-size: 16px;
margin: 5px;
text-transform: lowercase;
background-color: #fbeed7;
border: none;
padding: 10px 20px;
cursor: pointer;
}
table {
margin-top: 20px;
border-collapse: collapse;
}
th, td {
border: 1px solid #000;
padding: 10px;
font-family: 'Courier New', monospace;
text-transform: lowercase;
}
th {
font-size: 16px;
}
td {
font-size: 32px;
}
00:00
start
stop
last entry

[formidable id=35]
let stopwatchInterval;
let elapsedSeconds = 0;
function updateStopwatch() {
elapsedSeconds++;
const minutes = Math.floor(elapsedSeconds / 60);
const seconds = elapsedSeconds % 60;
document.getElementById('stopwatch').innerText =
(minutes < 10 ? '0' : '') + minutes + ':' + (seconds 0) {
const lastEntry = times[times.length - 1];
const row = timeTable.insertRow();
const cell = row.insertCell(0);
cell.innerText = lastEntry;
}
}
function submitForm() {
updateHiddenField();
document.getElementById('stopwatchForm').submit();
}
function updateHiddenField() {
const currentTime = document.getElementById('stopwatch').innerText;
document.getElementById('input_620').value = currentTime;
}
// Display saved times on load
window.onload = displayTimes;


WP Version: 6.6.2
Formidable Version: 6.16
1 Answers
Victor Font answered 2 months ago
If your form depends on userid to work, it will never function for logged out users because there is no user id available for your view to display the content.
Victor Font replied 2 months ago

How did you confirm the form entries that will not have user ids when logged out are not in the database?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right