Submitting forms as json

(7 posts) (2 voices)

Tags:

No tags yet.

  1. Rbert, Member

    Hi,

    When using the form extension, it would be very useful if the form could be submitted to a linked report as json, instead of the report needing to have an individual argument for each part of the form.

    Can you add this possibility? Thank you.

  2. myDBR Team, Key Master

    Sure,
    added into the latest build.

    --
    myDBR Team

  3. Rbert, Member

    Thank you.

    Is it necessary to require that the receiving report has only one parameter? I'm trying to do the following:


    select 'dbr.report', 'sp_DBR_save_product_json', '[form_action]', 'inJson=p_json';
    select 'dbr.form', 'json', 'inPostJson';
    select 'dbr.form', 'start', 'new_form';
    select 'form_action', json_object('action', 'new_product') as p_json; select 'dbr.form', 'text', 'sku', 'SKU', 50;
    select 'dummy'; select 'dbr.form', 'select', 'schema_id', 'Product Type';
    select id, product_type from AhaInfoCopy.product_json_schema;
    select 'dbr.form', 'submit', 'New Product';
    select 'dbr.form', 'end';
    select 'dummy';

    Where sp_DBR_save_product_json has two parameters, inJson, and inPostJson. I want to send {"action":"new_product"} as inJson, and the form data as inPostJson. Is this not possible?

    Thank you!

  4. myDBR Team, Key Master

    That code should work just fine.

    --
    myDBR Team

  5. Rbert, Member

    It does not work in my case - only inJson gets a value when I submit, inPostJson does not.

  6. myDBR Team, Key Master

    Try clearing the browser's cache. Most likely the browser is caching the JS file for the form.

    See the code working in the demo.

    --
    myDBR Team

  7. Rbert, Member

    It works now, thank you!


Reply

You must log in to post.