Adding dynamic fields with custom editor form not working

Adding dynamic fields with custom editor form not working

kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

Hello
I have a custom editor form .. to which I add new input fields when user clicks a button on form.

But the newly added field is not showing in the form.. and when I try and add same field again i get error from datatable js,

so that means that the field is in fact getting added but its not showing on the editor form.

the custom form is like :smile:

<div id="customForm">
    <fieldset class="firsthalf">
        <legend>Dispatch</legend>
        <div data-editor-template="id"></div>

    </fieldset>
    <fieldset class="secondhalf responsive-fieldset">
        <legend>Sauda Details</legend>
    </fieldset>
</div>

I am adding the field like

var field = {
                          'label' : "name",
                          'name'  : "Hello.."
                      };

editor.add(field);

Please let me know whats the problem here... thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 62,602Questions: 1Answers: 10,293 Site admin
    Answer ✓

    You'll need to modify your template to include the new field. You can get the template element using template() and then modify it using jQuery or DOM methods.

    Allan

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    Thanks allan..!!

This discussion has been closed.