Wait for 5 sec after submit, before redirect

Hello.
When I save a form, it redirects as per plugin, but after saving, I need a small dialog box to appear, count down 5 seconds, and then to redirect to the page. is this possible?
I see that there is a PHP plugin for the form, I'm guessing I should do something there?
Thanks a million.

I need this because I set the event on MySQL on a 5 sec loop, that populates the rest of the form/table based on what it finds in the field that was just saved.
 
I need this because I set the event on MySQL on a 5 sec loop, that populates the rest of the form/table based on what it finds in the field that was just saved.

That sounds very weird. Can you explain more about what you are doing and how/why you are doing it?

-- hugh
 
well, imagine a table with elements x, y, z. in the front end, the user inputs the x, and every 5 seconds, the mysql event executes an update of y and z based on the selection obtained by the x. the event updates the whole table and every record, so if I change x over time, y and z will inevitably be changed 5 secs later.

So I just need after clicking save on the form, that a pop-up displays for 5 seconds before complying with the redirect plugin of the form. in that period, the mysql will update the y and z, so the user doesn't see a form with just the X that he inserted into the form.

I hope I was clear enough.

I think it has something to do with jQuery popup, but I'm not really sure where to start.
 
The MySQL event has nothing to do with my question, but just to reassure you, I'll paste the code below. Because this event runs every 5 seconds, I need to have something on the front end hold the user from seeing the form with the new record for 5 seconds, until the event below can compile the rest of the form, based on the users entry (the user selects the ac.contratto_base in the form, and the event compiles the rest).

dZe4W5

Code:
CREATE
    DEFINER = 'dbase'@'%'
EVENT arhiva.contratti_scadenze
    ON SCHEDULE EVERY '5' SECOND
    STARTS '2017-09-21 12:10:08'
    DO
BEGIN
 /*Info sul contratto*/
UPDATE archivio_contratti ac, (SELECT id, fornitore, data_documento, descrizione FROM archivio) AS tabella
  set ac.fornitore = tabella.fornitore, ac.data_contratto= tabella.data_documento, ac.note= tabella.descrizione
  WHERE ac.contratto_base = tabella.id;
END;

ALTER EVENT arhiva.contratti_scadenze
    ENABLE
 
You can do this with a form upsert or php plugin, updating archivio_contratti once on user's form submit instead of running it every 5 seconds.
 
You can do this with a form upsert or php plugin, updating archivio_contratti once on user's form submit instead of running it every 5 seconds.
That's what I'm trying to get at, is what the mysql event stuff is doing, and if it's actually necessary. I suspect it could be done in a PHP form submission plugin.

Sent from my HTC6545LVW using Tapatalk
 
You can do this with a form upsert or php plugin, updating archivio_contratti once on user's form submit instead of running it every 5 seconds.
That's what I'm trying to get at, is what the mysql event stuff is doing, and if it's actually necessary. I suspect it could be done in a PHP form submission plugin.

Sent from my HTC6545LVW using Tapatalk
 
You can do this with a form upsert
I can't use upsert because the modified value is on the same table (otherwise I would have placed triggers on the MySQL server)
or php plugin, updating archivio_contratti once on user's form submit
Unfortunately, the documentation is all over the place, and I can't make the heads or tails of it. I am sure that it can be done, of course, but I am unable to connect what I learned about PHP from Linkedin and Codeacademy with Fabrik's wiki. There are too many loose ends and whys, and congrats to the people who got it.

But even so, I would have to create custom php plugins for forms in both languages, the workload is on the browser side instead of mysql, and I wouldn't have the certainty that the server looked at all the records and updated them accordingly, rather then two years down the road, an update broke fabrik and the historic reports are now all skewed.

Which is why after clicking Save, I just want a little pop-up that counts down to 5, and than lets the redirect plugin take the user to the form. I see them all the time on ads, download sites, even my bank is using them.
 
So why not back up a bit, and explain what you are trying to do, and we can advise on the best way of doing it.

Which form are you submitting, archivio_contratti or archivio?

I just have a very strong gut feeling that the way you are doing it is the wrong way to go.

-- hugh
 
Ok, let me try like this. Imagine a table with the aim to keep up with the deadlines for the contracts. It is made of three tables:
- archivio_contratti, where there's the main contract, the field for the company you signed it with, a description of what's it about, and the field for the latest deadline;
- deadlines, where for each archivio_contratti entry, you can specify a date, dropdown category, and a yes/no (is the deadline completed or not);
- documents, where for each archivio_contratti entry, you can select from the table archivio all the relevant documentation for that contract, and choose a category
They are represented in the front view like this:
form archivio_contratti:
---------------------------------------------------
archivio contratti form
---------------------------------------------------
1)..............................||2) ........................... ||
--------------------------------------------------
form footer text:
1)
Code:
{fabrik view=list id=124 archivio_contratti_scadenze___id_contratto={archivio_contratti___id} showfilters=1}
2)
Code:
{fabrik view=list id=120 archivio_contratti_documenti___id_contratto={archivio_contratti___id} showfilters=1}

all the user has to do is select the base contract in the archivio_contratti form, and the MySQL event after 5 seconds finds the rest and updates the info from archivio to archivio_contratti. For each contract, the user specifies the deadlines, and the MySQL event calculates the next deadline and places it on the archivio_contratti field for deadlines.
The archivio_contratti list has an introduction with: "{fabrik view=list" of a MySQL view containing only deadlines, supplier, date of contract, ordered by date. So I have deadlines above and list of contracts below.

MySQL event:
Code:
BEGIN
  /*Scadenze*/
  UPDATE archivio_contratti ac, (SELECT
  id, id_contratto, data_scadenza
FROM archivio_contratti_scadenze
WHERE archivio_contratti_scadenze.id IN (SELECT archivio_contratti_scadenze.id FROM archivio_contratti_scadenze
            JOIN
            (SELECT archivio_contratti_scadenze.id_contratto, MIN(archivio_contratti_scadenze.data_scadenza) AS max FROM archivio_contratti_scadenze
WHERE archivio_contratti_scadenze.concluso <> 1
                GROUP BY archivio_contratti_scadenze.id_contratto)
            max_data_documento
            ON
            (max_data_documento.id_contratto = archivio_contratti_scadenze.id_contratto
                AND max_data_documento.max = archivio_contratti_scadenze.data_scadenza))) AS tabella
  set ac.prossima_scadenza = tabella.data_scadenza
  WHERE ac.id = tabella.id_contratto;
/*Info sul contratto*/
UPDATE archivio_contratti ac, (SELECT id, fornitore, data_documento, descrizione FROM archivio) AS tabella
  set ac.fornitore = tabella.fornitore, ac.data_contratto= tabella.data_documento, ac.note= tabella.descrizione
  WHERE ac.contratto_base = tabella.id;
END
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top