How to write overwrite custom javascript for save button in quick create form

1.9k views Asked by At

I want to do some validation for my custom quick create form.

I have added some JS code in full form. its working fine in full form. but same thing is not working in quick form.

'customCode' => '<input title="Save [Alt+S]" accessKey="S" class="button" onclick="this.form.action.value=\'Save\'; return test();" type="submit" name="button" value="Save">'
2

There are 2 answers

3
Sachin I On BEST ANSWER

To customize subpanel buttons.

Suppose we need to hide Create and Select buttons, or if we need to navigate quick create to full form. Then we need to follow following steps.

We need to first see the Subpanel's name.(which you can find out from studio/module/Relationships).

Navigate to custom/Extension/modules/Parent_Module/Ext/Layoutdefs

create one file like custombysachin.php.

and code like this.

<?php
$layout_defs["parent_module"]["subpanel_setup"]["subpanel_name"]['top_buttons']= array (
    0 =>
    array (
      'widget_class' => 'SubPanelTopCreateButton',
    ),   

 // 1 =>
    // array (
      // 'widget_class' => 'SubPanelTopSelectButton',
      // 'mode' => 'MultiSelect',
    // ),

  );
?>
2
Sachin I On

Hi You need to add same js file into related module. If you are looking to changes Accounts subpanel in Contacts module then your code will be as

File Path: custom/module/Accounts/metadata/quickcreatedefs.php

<?php
$viewdefs ['Accounts'] = 
array (
  'QuickCreate' => 
  array (
    'templateMeta' => 
    array (         
      'maxColumns' => '2',     
      'includes' => 
      array (
        0 => 
        array (
          'file' => '{path-to-js-file}',
        ),
      ),
      'useTabs' => false,
    ),       
  ),
);
?>