How to reload page?

  1. My goal: To know if there is a way to reload the page so that it prevents bypassing of checks after running successfully.
  2. Issue: My data checks from button submit seems to get bypassed after running successfully. I want to prevent bypassing my checks on submit button.
  3. Steps I've taken to troubleshoot: Attached is my javascript query for datacheck button submit.

function validateAndInsert() {
    const inputs = [
        { value: textInput3.value, name: 'Guest Name' },
        { value: select1.value, name: 'Room Type' },
        { value: select8.value, name: 'Room Number' },
        { value: dateTime3.value, name: 'Check-In and Time' },
        { value: dateTime4.value, name: 'Check-Out and Time' },
        { value: select2.value, name: 'Mode of Payment' },
    ];

    const missingInputs = inputs.filter(input => !input.value).map(input => input.name);

    if (missingInputs.length) {
        utils.showNotification({
            title: 'Input Required',
            description: `Please provide the following inputs: ${missingInputs.join(', ')}`,
            notificationType: 'warning',
            duration: 5
        });
    } else {
        insert_customer_details_query.trigger({
            onSuccess: () => utils.showNotification({
                title: 'Success',
                description: 'Customer details inserted successfully!',
                notificationType: 'success',
                duration: 5
            }),
            onFailure: () => utils.showNotification({
                title: 'Error',
                description: 'Failed to insert customer details.',
                notificationType: 'error',
                duration: 5
            })
        });
    }
}

return validateAndInsert();```

Hey @Al_Christian_Gochangco - thanks for reaching out. Instead of refreshing the entire page, I have a feeling that the only thing you need to do is call reset() on the JS query that you're using to validate your form.

Give that a shot and let me know if it works!

2 Likes

It worked. Thanks @Darren for the help.

1 Like