OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – HTML, JavaScript, CSS, Design Questions Component with the name …. is already registered in the layout

This topic contains 1 reply, has 2 voices, and was last updated by  franconob 7 years, 6 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #25627

    golriz.nourani
    Participant

    Dear Sir
    I create a JavaScript component ,I use this component in create page of b2bcustomer and I have below error on loading page

    Component with the name “orocrm_sales_b2bcustomer_form_dataChannel” is already registered in the layout

    could you help me?
    regards,
    Golriz

    ……component code

    define(function (require) {
    ‘use strict’;

    var _ = require(‘underscore’),
    $ = require(‘jquery’);

    return function (options) {

    //var $identifier = options._sourceElement.find(options.identifier),
    var $customerType = options._sourceElement.find(options.customerType),
    $box1 = options._sourceElement.find(options.box1),
    $box2 = options._sourceElement.find(options.box2),
    $box3 = options._sourceElement.find(options.box3);

    var $lbox1 = $box1.find(‘label’),
    $lbox2 = $box2.find(‘label’),
    $lbox3 = $box3.find(‘label’);

    var onCorporation = options.onCorporation || [];
    var onPersonal = options.onPersonal || [];

    $customerType.on(‘change’, function() {
    if (_.contains(onCorporation, $(this).val())) {
    $box1.addClass(‘hide’);
    $box1.find(‘input’).each(function() {
    $(this).rules(‘remove’, ‘NotBlank’);
    });

    if ($lbox1.hasClass(‘required’)) {
    $lbox1
    .removeClass(‘required’)
    .find(’em’).html(‘ ‘);
    }

    $box2.removeClass(‘hide’);

    $box2.find(‘input’).each(function() {
    $(this)
    .removeClass(‘hide’)
    .rules(‘add’, ‘NotBlank’);
    });

    if (!$lbox2.hasClass(‘required’)) {
    $lbox2
    .addClass(‘required’)
    .find(’em’).html(‘*’);
    }

    $box3.removeClass(‘hide’);

    $box3.find(‘input’).each(function() {
    $(this)
    .removeClass(‘hide’)
    .rules(‘add’, ‘NotBlank’);
    });

    if (!$lbox3.hasClass(‘required’)) {
    $lbox3
    .addClass(‘required’)
    .find(’em’).html(‘*’);
    }
    }
    if (_.contains(onPersonal, $(this).val())) {
    $box1.removeClass(‘hide’);

    $box1.find(‘input’).each(function() {
    $(this)
    .removeClass(‘hide’)
    .rules(‘add’, ‘NotBlank’);
    });

    if (!$lbox1.hasClass(‘required’)) {
    $lbox1
    .addClass(‘required’)
    .find(’em’).html(‘*’);
    }

    $box2.addClass(‘hide’);
    $box2.find(‘input’).each(function() {
    $(this).rules(‘remove’, ‘NotBlank’);
    });

    if ($lbox2.hasClass(‘required’)) {
    $lbox2
    .removeClass(‘required’)
    .find(’em’).html(‘ ‘);
    }

    $box3.addClass(‘hide’);
    $box3.find(‘input’).each(function() {
    $(this).rules(‘remove’, ‘NotBlank’);
    });

    if ($lbox3.hasClass(‘required’)) {
    $lbox3
    .removeClass(‘required’)
    .find(’em’).html(‘ ‘);
    }
    }
    });

    };
    });

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #25628

    franconob
    Participant

    Hey guys! I need to extend some functionality from a page component in some core bundle. Is that possible through javascript? Maybe extending a javsacript component from the core? O I must extend the bundle and override the template and JS?

    Thanks!

Viewing 1 replies (of 1 total)

The forum ‘OroCRM – HTML, JavaScript, CSS, Design Questions’ is closed to new topics and replies.

Back to top