Hello Team,
I have save button with progress bar and I want the progress bar display after the save button is click, but what is happing now is the progress bar is always spinning without even clicking the save button, mean while I tried it on different application and it work but when I implement it here it doesn't work.
Tuhin PaulPosted Apr 18, 2023, 7:23 AM
Sample code:
.
the progress bar will only display after the SaveInvoice function is called, and the displayprogressmessage function is called within it.
Tuhin PaulPosted Apr 18, 2023, 7:22 AM
The way the displayprogressmessage function is being called, It's possible that the function is being called before the button is clicked, which is why the progress bar is always spinning. One solution could be to remove the onclick attribute from the button and instead call the displayprogressmessage function within the SaveInvoice function after the save operation is complete. This way, the progress bar will only display after the button has been clicked and the save operation is actually in progress.
Vishal JoshiPosted Apr 17, 2023, 6:31 AM
Hello
You need to hide the spinner on the complete of SaveInvoice method.
once invoice save changes are completed and response back from the server need to add the below code.
Thanks
Vishal
Emmmanuel FIADUFEPosted Apr 10, 2023, 3:51 PM
Swain, please I did the changes as you stated here but is still not working
Rajkiran SwainPosted Apr 10, 2023, 11:46 AM
Based on the code you provided, it seems that the progress bar is always displayed because the CSS class "hidden" is not being added to the progress bar initially. You can try adding the "hidden" class to the progress bar div by default and then removing it only when the button is clicked.
Emmmanuel FIADUFEPosted Apr 10, 2023, 11:03 AM
Hello Swain,
This is my javascript code
function displayprogressmessage(ctl, msg) {
$(ctl).prop("disabled", true).text(msg);
$("body").addClass("submit-progress-bg");
// Wrap in setTimeout so the UI
// can update the spinners
setTimeout(function () {
$(".submit-progress").removeClass("hidden");
}, 1);
return true;
Rajkiran SwainPosted Apr 10, 2023, 5:24 AM
It looks like there might be a syntax error in your code. The
onclickattribute in yourbuttonelement is not closed properly.Try replacing your
buttonelement with the following code:Also, make sure that your JavaScript function
displayprogressmessageis properly defined and included in your code.If the issue still persists, you can try using the
addEventListenermethod in your JavaScript code instead of theonclickattribute in your HTML. Here is an example: