How to create a Pre-Populated DTEditor?

How to create a Pre-Populated DTEditor?

sadamiqbalsadamiqbal Posts: 18Questions: 6Answers: 0

Hello, i am trying to prepopulate a DTEditor, but the issue i am having is that the Editor is remembering the var previously set.

What i am doing at the moment is prepopulating an Editor field using an external add button. But when i use another add button , it is remembering the old added value.

Is there anyway to call the "dataConnectionsEditor.on('open ', function (e, json, data)" and sent some parameter to that function? If so please tell me how.

Thank you in advance and your precious time for reading this.

dataConnectionsEditor.on('open ', function (e, json, data)
{
    var userEnteredQueryDataDipConfig = $("#actionDataDipConfigQueryCombo").mnCombobox('getMyValTyped');
    $('#DTE_Field_name').val(userEnteredQueryDataDipConfig);                  //transfer userTypedQuery from CallFlowConfig  to DTEditor

    //var actionSalesforceDataDipQuerySelectVal = $("#actionSalesforceDataDipQuerySelect").mnCombobox('getMyValTyped');  
    //$('#DTE_Field_name').val(actionSalesforceDataDipQuerySelectVal);

});

This question has accepted answers - jump to:

Answers

  • sadamiqbalsadamiqbal Posts: 18Questions: 6Answers: 0

    Or, Is is possible to call the Editor create method with parameter which will then prepopulate the form?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    edited September 2014 Answer ✓

    The Editor create should populate the form using the field defaults (fields.def). It shouldn't be using the value form a previous edit. Are you able to link me to a page that shows that problem?

    Or, Is is possible to call the Editor create method with parameter which will then prepopulate the form?

    At the point above you can use val() to set the values of the fields that you want (note I would recommend using the Editor API rather than the direct DOM manipulation as you have above) - for example editor.val( 'name', serEnteredQueryDataDipConfig );

    Thanks,
    Allan

  • sadamiqbalsadamiqbal Posts: 18Questions: 6Answers: 0

    Nice, thank you very much Allan. I appreciate you answer. It does work only after the first time i press the add button. On the second time the form open, is then prepopulated. Am i doing something wrong? Am i using the right event listener (open )? I have also tried init, pre-open, but does not work :-( . I am sorry for not being able to provide a link coz the site is not online yet. Any help or advice will be very much appreciated.

    Thks again for your previous solution Allan

  • sadamiqbalsadamiqbal Posts: 18Questions: 6Answers: 0
    edited September 2014

    Okayyy, i found the solution, i should not put my code in dataConnectionsEditor.on('open', function (e, json, data). For the people who might read this in future:

    $(".addNewRecord").click(function ()
    {
        $('#DTTTollAddNewButton').trigger("click");
        var newVarVal = $('#JQueryCombo').mnCombobox('GetVal'); 
        dataConnectionsEditor.val('name', newVarVal);
    });
    

    This chunk of code prepopulated your DTEditor form with the vale set(name in this case).
    loving this editor it has numerous possibilities...

    Thnks Allan

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Good to hear you got it working :-)

    Allan

This discussion has been closed.