dbr.upload in popup

(2 posts) (2 voices)

Tags:

No tags yet.

  1. gallogallegos, Member

    when I use dbr.upload in a popup report, I can't find a way to refresh the report in the parent window once the popup is closed.

    I used a javascript function in dbr.report.

    select 'dbr.report', 'sp_DBR_entregas_image_uploader', '[ver1]',"popup", 'in_entregaid=Entrega_id','in_foto="1"','in_accion=[ver1]','in_url=url1','callpopupclose=function () {window.location.reload();}';

    I used dbr.refresh in the popup reports ----

    select 'dbr.upload.options', 'noreplace', 1;
    select 'dbr.upload.options', 'accepted_files', '.jpg,.png,.jpeg';
    select 'dbr.upload.options', 'maxfilesize', 1;

    select 'dbr.upload', '/var/www/mydbr/user/images/entregas/', 'sp_DBR_entregas_image_update', in_entregaid,in_foto;

    select 'dummy';
    select "dbr.refresh";

    I used dbr.refresh in the report that makes the update in the database --

    UPDATE entregas.entregas
    SET entregas.foto = concat(in_path, in_file)
    Where entregas.entrega_id=in_entregaid;

    SELECT concat('Se cargó la fotografía: ', in_file, ' con un tamaño de: (',format_bytes(in_size),')\nPor favor cierre este recuadro.');

    select "dbr.refresh";

    nothing.

  2. myDBR Team, Key Master

    if you want to refresh the page once the popup is closed, you add the refresh to callpopupclose. The callpopupclose took a function name as a parameter, not an anonymous function. Being able to use an anonymous function was such a nice idea that we added support for it in the latest build. For older versions you declare the function and just use the function name as a parameter.

    The select "dbr.refresh" at the end of the upload report does not work as the report is not a full report (no dbr-commands are parsed) and it expects only a single text shown to the user to be returned. You could return a script tag with window.location.reload in it, but that would probably confuse the user as the popup would close unexpectedly right after the upload and no indication of upload success would be shown to the user.

    --
    myDBR Team


Reply

You must log in to post.