I’m using this code on a page and I have additional Javascript that hides the component if a criterion is met but when I submit the form and the page refreshes it doesn’t refresh the Javascript that is supposed to hide the component. If I hit the browser refresh button the component hides as intended.
Works great if you are uploading a file. It’ll update all text fields but not a file / attachment field. How can we refresh after form has submitted files as well. I’d be ok redirecting to the same page or using a custom URL but they do not reload the page if you specify the same page.
This is great for form submissions without error. However, when a form is submitted with an error, the page reloads too fast to see the error. It looks like the form was submitted successfully. Would it be possible to make a “pause” before the reload?
I tried to add this:
setTimeout(function () {
location.reload(true); //MODIFICATION
}, 5000);
function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}
TB.render('component_ID', function(data) {
data.ele.find('.af-form-submit').on('click',function(){
wait(5000);
location.reload();
});
});
Your code using the wait function worked marvelously, but the user never sees the whether the form was successfully saved. Is there a way to reload only if the form submission was successful?
Hi Tadabase - I am new to javascript. I am able to refresh the entire page upon form submission and clicking an action link. However, I am not able to do so with the Task Button. Is there a special trick besides changing the component ID? Thank you