angular icon indicating copy to clipboard operation
angular copied to clipboard

Custom HTML modal for editing a form field

Open adamhrosenberg opened this issue 6 years ago • 3 comments

Hello,

I'm interested in intercepting the event fired when clicking the 'gear' icon over a form field so that I can display my own html for the window instead of what is provided by form.io. The idea is to have a simpler UI for users since a lot of the options provided isn't needed for them.

I've looked at the events outputted by form.io and this definitely isn't one of them the only thing I've been able to latch onto is a mouse click whose target class list contains the button. Which...isn't ideal. Is there a more streamlined way of doing this in form.io? I've searched online what I can but don't see examples of it, but when evaluating form.io originally I thought I saw a way to provide an html string for the modal.

I've found examples of online of editing which tabs and fields are available to the user, so I can hide everything but unsure how to ADD fields to the modal that weren't there previously.

Thanks,

Adam Rosenberg

adamhrosenberg avatar Feb 04 '20 16:02 adamhrosenberg

I'm interested in that too, I am trying to override the default window and show my own, done with angular material components

HenriqueVilela avatar Feb 05 '20 14:02 HenriqueVilela

The best way to do this is to just override the editForm's for all components, which would allow you to create your own. Something like this would work.

Formio.Components.components.forEach((component) => {
  component.editForm = function() {
    return {
      components: [
        {
           type: 'textfield',
           label: 'Label',
           key: 'label'
        }
      ]
    };
  };
});

This would reset all form overlays to just show the "label". You can now pick and chose how you want the edit forms to look like.

travist avatar Feb 10 '20 14:02 travist

We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.

If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.

Sidiro23 avatar Feb 07 '24 14:02 Sidiro23