usama shafiq
usama shafiq

Reputation: 19

How can I edit a form created by using Form.io in MVC

I created form using Form.io in MVC. Now I want to edit the created form how can I do that. I have HTML of the created form. If someone kindly assist me in it. I am new to Form.io. And I really need to edit form my code is posted below.

   Formio.builder(document.getElementById('builder'), {}, {
    builder: {
        basic: false
        customBasic: {
            title: 'Basic Components',
            default: true,
            weight: 0,
            components: {
                textfield: true,
                textarea: true,
                email: true
            }
        }
        layout: {
            components: {
                table: false
            }
        }
    }
}).then(function (form) {
    $("#saveForm").on('click', function (submission) {

        var id = document.querySelector('[id^=builder-element-]').id
        var content = $(".formarea:eq(0)>div");
        var finalHtml = "";

        $.each(content, function (value, index) {
            var el = $(index);
            finalHtml += el.html();

        })
       // ajax call to save html
    });

Upvotes: 0

Views: 987

Answers (2)

Ananda
Ananda

Reputation: 918

The documentation can be found here

Formio.builder(element, [form], [options])

A fiddle to demo the above usage.

I am re-creating the form builder interface with JSON schema of a saved form.

Upvotes: 0

lschwalf
lschwalf

Reputation: 11

The interface for this particular library is not documented very well in the Formio docs. The second parameter passed to Form.builder() is the JSON schema of the form you want to edit.

Upvotes: 1

Related Questions