Welcome to the nuBuilder Forums!
Register and log in to access exclusive forums and content available only to registered users.
Register and log in to access exclusive forums and content available only to registered users.
delay before nuGetBreadcrumb() Topic is solved
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
delay before nuGetBreadcrumb()
On the form, using php, I make a request to the database 1. If the data is received, I write it to another database 2. Using js, I fill the table from
database 2 on the same form, save the form and update with nuGetBreadcrumb() on the ssame button with php-procedure.
Task: If data is not received, display a message for the user.
Problem:
nuDisplayError displays a message for a very short time because nuGetBreadcrumb() fires.
nuJavascriptCallback() does not display this message at all for the same reason.
How to make a delay before nuGetBreadcrumb() in case of an empty database request.
database 2 on the same form, save the form and update with nuGetBreadcrumb() on the ssame button with php-procedure.
Task: If data is not received, display a message for the user.
Problem:
nuDisplayError displays a message for a very short time because nuGetBreadcrumb() fires.
nuJavascriptCallback() does not display this message at all for the same reason.
How to make a delay before nuGetBreadcrumb() in case of an empty database request.
-
- nuBuilder Team
- Posts: 4298
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: delay before nuGetBreadcrumb()
Hi,
Use JS setTimeout()
Use JS setTimeout()
Code: Select all
var delayInMilliseconds = 1000; //1 second
setTimeout(function() {
//your code to be executed after 1 second
nuGetBreadcrumb();
}, delayInMilliseconds);
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: delay before nuGetBreadcrumb()
Where to place this code?
On my button, it's already implemented like this:
onclick - nuRunPHPHidden('DB'); nuGetBreadcrumb(); nuMessage(['Wait...']);
onclick - getCurrentTime('#konv_vr');
On my button, it's already implemented like this:
onclick - nuRunPHPHidden('DB'); nuGetBreadcrumb(); nuMessage(['Wait...']);
onclick - getCurrentTime('#konv_vr');
-
- nuBuilder Team
- Posts: 4298
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: delay before nuGetBreadcrumb()
nuRunPHPHidden() is executed asynchronous, that means nuGetBreadcrumb(); is usually called before nuRunPHPHidden() has finished executing.
The way to go is to run nuRunPHPHidden() and call nuJavascriptCallback() within the PHP code that executes nuGetBreadcrumb(); etc,
The way to go is to run nuRunPHPHidden() and call nuJavascriptCallback() within the PHP code that executes nuGetBreadcrumb(); etc,
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: delay before nuGetBreadcrumb()
Unfortunately the code does not work as expected.
The visibility of nuMessage and nuDisplayError is very low to read the message.
As an alternative, I applied alert via nuJavascriptCallback.
The visibility of nuMessage and nuDisplayError is very low to read the message.
As an alternative, I applied alert via nuJavascriptCallback.
-
- nuBuilder Team
- Posts: 4298
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: delay before nuGetBreadcrumb()
Do you need to call nuGetBreadcrumb() at any case, if there is an error or not?
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: delay before nuGetBreadcrumb()
nuGetBreadcrumb() in any case, it must be applied, because i need to save the time of button click. It could be that nuSaveAction() applied on the same button prevents the nuMessage from being displayed for a long time. It does not give errors according to your code, but as I said, the message display is very short.
-
- nuBuilder Team
- Posts: 4298
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
Re: delay before nuGetBreadcrumb()
I tested it with this Procedure and the message is shown for 3 seconds before the form is refreshed.
Code: Select all
nuRunPHPHidden('msgtest',0)
You do not have the required permissions to view the files attached to this post.
-
- nuBuilder Team
- Posts: 4298
- Joined: Sun Oct 14, 2018 6:43 pm
- Has thanked: 71 times
- Been thanked: 445 times
- Contact:
-
- Posts: 366
- Joined: Sat Apr 11, 2020 12:03 am
- Has thanked: 3 times
- Been thanked: 4 times
- Contact:
Re: delay before nuGetBreadcrumb()
Your code works... but I've decided that alert() is preferable to ensure that the user is informed.
Thanks !
Thanks !