Skip to content

Uncaught TypeError: Cannot read property 'insertBefore' of undefined #725

@Priler

Description

@Priler

Hi!

Here is my schema:

	        // The schema for the editor
	        schema: {
	          type: "array",
	          title: "Список",
	          format: "table",
	          items: {
	            title: "Ингредиент",
	            headerTemplate: "{{i}} - {{self.title_ru}}",
	            properties: {
	            	product: {
	            		title: 'Продукт',
	            		type: 'string',
	            		format: 'select2-products'
	            	},
	            	value: {
	            		title: 'Значение',
	            		type: 'number'
	            	},
	            	measure: {
	            		title: 'Мера',
	            		type: 'string',
	            		enum: ['gr','tablespoon', 'teaspoon', 'glass', 'piece'],
	            		options: {
	            			enum_titles: ['грамм','Столовая ложка','Чайная ложка','Стакан','Штука']
	            		}
	            	},
	            	optional: {
	            		title: 'По вкусу?',
	            		type: 'boolean',
	            		format: 'checkbox'
	            	}
	            }
	          }
	        },

If last propertie ("optional") having format = 'checkbox' then I have this error in Console.

Uncaught TypeError: Cannot read property 'insertBefore' of undefined

It's on line 6286

    if(input.type === 'checkbox' && label) {
      label.insertBefore(input,label.firstChild);
    }

Possible fix:

    if(input.type === 'checkbox' && label) {
      label.insertBefore(input,label.firstChild);
    }

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions