Draggable / formeo

Drag & Drop Form Builder
http://draggable.github.io/formeo/
MIT License
525 stars 195 forks source link

Custom fields #159

Open johndavemanuel opened 5 years ago

johndavemanuel commented 5 years ago

Hi!

Do you have tutorial for adding custom fields?

Is it possible to add like input types like (email,password etc) ?

kevinchappell commented 5 years ago

Absolutely. The tutorial is not finished but you can create simple custom fields via options by adding it to elements

ex:

elements: [
      {
        tag: 'input',
        config: {
          label: 'Password',
          disabledAttrs: ['type']
        },
        meta: {
          group: 'common',
          id: 'password',
          icon: '***',
        },
        attrs: {
          type: 'password'
        },
      },
]

Custom inputs like tinymce and cleave.js can be created using the above method with onRender action to instantiate or by creating a custom control similar to formBuilder.

johndavemanuel commented 5 years ago

Great! Thanks! Also when I try to run the demo on my local I got an errror

TypeError: window.FormeoEditor is not a constructor formeo-master/demo/assets/js/demo.js:142

How can I fix this?

kevinchappell commented 5 years ago

There is a bug in the current release I'm working on now causing that error. It will work if you run yarn start from the repo otherwise you'll need to change the location of formeo.min.js in index.html

johndavemanuel commented 5 years ago

"you'll need to change the location of formeo.min.js in index.html"

Also trying yarn start is error

$ yarn clean && yarn copy
$ rm -rf dist/* demo/assets/formeo*
'rm' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I try it but still the same

kevinchappell commented 5 years ago

ok i see. I should have made yarn clean cross platform. rm won't work on windows outside of WSL on Windows. Can you try the Ubuntu bash or Git shell? I need to focus on completing other features and docs but after will definitely focus on Windows support.

johndavemanuel commented 5 years ago

Is this issue already fixed?

jmorvan commented 5 years ago

@johndavemanuel , nope, as of today could not build on windows with PS or CMD. GIT Shell worked though.

Seems like there is still a bug in the latest. Building doens't provide you with a constructor for Formeo. Only the builder and the render classes.

I had to take the .js and .svg from the demo.

johndavemanuel commented 5 years ago

@jmorvan yes it is, I also do it from the demo,

kevinchappell commented 5 years ago

It's sounds like this is a separate issue from custom fields. Can someone make a separate issue with the details? Prs also welcome.

intelligence0504 commented 5 years ago

I got the following issue. TypeError: window.Formeo is not a constructor

FormeoEditor.componentDidMount src/App.js:24

21 | }; 22 | 23 | // new Formeo({ container: '.build-form' }); 24 | new window.Formeo(options); 25 | } 26 | 27 | render() {