Editable fields lose data entry when the next click is on a button made with 'dbr.button'.

(7 posts) (2 voices)

Tags:

No tags yet.

  1. jptreen, Member

    When I don't refocus first (e.g. with a tab or a click away) first, I am losing the data entered in my editable field when I press a button (built with dbr.button) which makes changes to the database, and executes instead of the editable field's normal behaviour when focus is lost on it.

    After this, to persist the changes I made to the field happen (I can still see them there on the screen, but they were never saevd) I have to refocus on it and then focus away.

    How can I fix this so that I can just fill in the field then click the button without losing the data?

  2. myDBR Team, Key Master

    What does the action behind the dbr.button do? Does it leave/refresh the page?

    The editable triggers when the field loses focus (or if you enable the OK button and click OK). If you click a link in a page which leads to another page, browsers will not trigger the change.

    --
    myDBR Team

  3. jptreen, Member

    The button updates the database, then sends an email. It does not do a 'dbr.refresh', or any extra js either.

    I've slowed down and done a little more looking, and the data does save, but that change is not reflected in the email sent. That's the problem I am having.

  4. myDBR Team, Key Master

    What is happening is that the both the editing and the dbr.button send out Ajax requests (one for update and one for fetching the data). Whoever wins that race, gets to the data first. Easiest solution would be to slow down the dbr.button action a bit to let the editing update the data first.

    You could try adding slight delay in code behind the dbr.button (try out which value works for you):

    declare v_sleep int;
    select sleep(1) into v_sleep;

    --
    myDBR Team

  5. jptreen, Member

    Hi,

    Thanks for getting back in touch again.

    I have popped the sleep into the procedure called by the button (I went up to 10 seconds just to make 100% sure of what I was seeing). It does add a wait time, but doesn't change the issue. It looks like the editable field just won't save until that procedure has finished (the 1px black border around the editable field remains until the procedure called by the button has executed completely).

  6. myDBR Team, Key Master

    Check if you have "Use embedded charts"-setting set in Environment settings. This allows myDBR to close session earlier, so the second process to continue it's execution.

    Another way of doing this is that you can delay the dbr.button Ajax call, so that the editable can go first. Easiest way to do this is to hide the actual dbr.button and use another one which uses timeout to delay the click.

    See a sample.

    --
    myDBR Team

  7. jptreen, Member

    That's fixed it. Thank you!


Reply

You must log in to post.