Search code examples
sugarcrm

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


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">'

Solution

  • 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',
        // ),
    
      );
    ?>