dbr.editable question

(3 posts) (2 voices)

Tags:

  1. ajdjackson, Member

    Hi

    I've a query re dbr.editable.

    I've a field that I'm making ediatbel. However I wish the user to confirm if he wishes to proceed with the update if the new value is say 10 times greater that the value of another field.

    Is this possible (I'm sure it is) and if so can you give me some pointers please? I think I'm looking for something similar to the callbefore for dbr.report.

    Thanks

    Jake

  2. myDBR Team, Key Master

    Jake,
    that requires some Javascript.

    For the callbefore, you can define the onsubmit event handler like this:

    select 'dbr.editable', '[yourcell]', 'sp_DBR_edit', "options={'onsubmit':onsubmit_call}";

    Assuming your cells are integer values and the column to compare to is column 2, you define the function as:

    select 'dbr.javascript', "
    function onsubmit_call(settings, cell)
    {
    var edited_value, another_col; edited_value = Cell_data.get_value_raw( $(cell).find('input').val(), 'int' );
    another_col = col_value_get( cell, 2 ); if ( (edited_value>10*another_col) && !confirm('Do you to set the value this high?')) {
    cell.reset();
    return false;
    }
    return true;
    }
    ";

    --
    myDBR Team

  3. ajdjackson, Member

    Brilliant!

    Many thanks - worked a treat.

    HAGWE

    Jake


Reply

You must log in to post.