Need to create module "Equipent" with a lot of "if"

So I have 2 main modules:
1)Customers
2)Equipment & Configuration

My target: easy with a lot of dropdown elements add new equipment and it’s config to customer list.

Here is my steps:
1)I chouse what equipment I need to create from a dropdown list.
2)In next step CRM must automatically choose what else data I need to add to that equipment.
a)for example if it’s cable, system must give me option to specify it’s length
b)if it’s Firewall, system must give me options to add it’s IP and etc.
So everything must be automatically.

I need a lot of “if” where:
if I choose Firewall as my equipment, there must be one set of options.
if I choose Cables as my equipment, there must be another set of options.

How can I do that?

Firstly you’ll need to add all the potential extra fields using studio.

Then if you edit the view def for your module you can get it to include custom javascript (which will be the best way to hide/show fields). You can find the file to edit at custom/modules/metadata/YOURMODULENAME/metadata. You’ll need to add something like:

‘includes’ =>
array (
0 =>
array (
‘file’ => ‘custom/modules/YOURMODULENAME/js/YOURJAVASCRIPTFILENAME.js’,
),
),

I presume you’re capable of writing the javascript to hide and show fields. If you’re not sure jquery would make this very easy for you. To check and remove the validation for a field you need the following code:

if (checkValidate(“EditView”, “yourfieldname”)) {
removeFromValidate(“EditView”, “yourfieldname”);
}

Thanks for reply, at least I know it’s possible.

Does there some detail guide how I can perform exactly what I mention before with jquery or javascript?

Here is an example of javascript I wrote so that the user has to enter a reason when the sales stage of an opportunity is set to closed lost. If it’s set to anything else they wont see the field.

$(document).ready(function()
{



    // hide reason lost from form if sales stage isn't closed lost
    if ($('#sales_stage').val() != 'Closed Lost') {
        $('#reason_lost_c_label').html('');
        $('#reason_lost_c').hide();

        // remove validation from  reason lost as it's only required if sales stage is set to closed lost
        if (checkValidate("EditView", "reason_lost_c")) {
            removeFromValidate("EditView", "reason_lost_c");
        }
    }

    // if sales stage dropdown has changed check if we need to add reason lost (and it's validation back to form)
    $('#sales_stage').change(function () {

        if ($('#sales_stage').val() == 'Closed Lost') {
            addToValidate('EditView', 'reason_lost_c', 'id', true, '');
            $('#reason_lost_c_label').html('Reason Lost: <span class="required">*</span>');
            $('#reason_lost_c').show();
        } else {
            $('#reason_lost_c_label').html('');
            $('#reason_lost_c').val('');
            $('#reason_lost_c').hide();
            removeFromValidate("EditView", "reason_lost_c");
        }
    });
});

Thanks, but it still hard for me.

I have php file of my edit view:
/var/www/suitecrm/custom/modules/[color=#ff4400]iosa1_Equip_and_config[/color]/metadata/editviewdefs.php
Red collor - it’s name of my modul

So in Studio > iosa1_Equip_and_config > Layout > Edit View I created some Pannels with row and fields

As you can see I have dropdown field “Type of Item”, it’s real name is [color=#ff4400]type_of_item_c[/color] . In that field I use dropdown list [color=#ff4400]type_of_item_list[/color] with only 2 values:
1)BUC [BUC]
2)UPS [UPS]

So I need:
When I choose BUC, all Panel with UPS must be hide
When I choose UPS, all Panel with BUC must be hide
That’s all.

Here is guide that I found, but it miss some crutial elements, so for me it’s like Puzzle.
https://jatinmarwah.wordpress.com/2010/06/13/sugarcrm-programmatically-hiding-and-displaying-panels-based-on-the-value-of-a-drop-down/

Could you please explain to me where I need to look, if that’s my current code in
/var/www/suitecrm/custom/modules/[color=#ff4400]iosa1_Equip_and_config[/color]/metadata/editviewdefs.php

<?php
$module_name = 'iosa1_Equip_and_config';
$viewdefs [$module_name] = 
array (
  'EditView' => 
  array (
    'templateMeta' => 
    array (
      'maxColumns' => '2',
      'widths' => 
      array (
        0 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
        1 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
      ),
      'useTabs' => false,
      'tabDefs' => 
      array (
        'DEFAULT' => 
        array (
          'newTab' => false,
          'panelDefault' => 'expanded',
        ),
        'LBL_EDITVIEW_PANEL1' => 
        array (
          'newTab' => false,
          'panelDefault' => 'expanded',
        ),
        'LBL_EDITVIEW_PANEL2' => 
        array (
          'newTab' => false,
          'panelDefault' => 'expanded',
        ),
      ),
    ),
    'panels' => 
    array (
      'default' => 
      array (
        0 => 
        array (
          0 => 'name',
          1 => 
          array (
            'name' => 'accounts_iosa1_equip_and_config_1_name',
          ),
        ),
        1 => 
        array (
          0 => 
          array (
            'name' => 'type_of_item_c',
            'studio' => 'visible',
            'label' => 'LBL_TYPE_OF_ITEM',
          ),
          1 => 
          array (
            'name' => 'type_or_item_child_c',
            'studio' => 'visible',
            'label' => 'LBL_TYPE_OR_ITEM_CHILD',
          ),
        ),
      ),
      'lbl_editview_panel1' => 
      array (
        0 => 
        array (
          0 => 'assigned_user_name',
          1 => 
          array (
            'name' => 'date_modified',
            'comment' => 'Date record last modified',
            'label' => 'LBL_DATE_MODIFIED',
          ),
        ),
        1 => 
        array (
          0 => 
          array (
            'name' => 'date_entered',
            'comment' => 'Date record created',
            'label' => 'LBL_DATE_ENTERED',
          ),
          1 => 
          array (
            'name' => 'created_by_name',
            'label' => 'LBL_CREATED',
          ),
        ),
      ),
      'lbl_editview_panel2' => 
      array (
        0 => 
        array (
          0 => 'description',
          1 => 
          array (
            'name' => 'modified_by_name',
            'label' => 'LBL_MODIFIED_NAME',
          ),
        ),
      ),
    ),
  ),
);
?>