AnsweredAssumed Answered

Button that can change value of a field

Question asked by Dev Student on Jun 14, 2016
Latest reply on Jun 21, 2016 by Dev Student

Hello! I would like to ask how can I make a button change a value of a field.
Quote Payment - 1.png

As seen on the image above, The Dropdown Status should be changed from 'Not Paid' to 'Paid.' I've tried altering the metadata, but I have trouble calling the field and changing its value. All I know is, my 'Status' field is LBL_Quote_Stage.

 

Possible Solutions please?

 

Also, here's my metadata:

 

 

<?php
$module_name = 'UA_Quotes';
$viewdefs [$module_name] = 
array (
  'DetailView' => 
  array (
    'templateMeta' => 
    array (
      'form' => 
      array (
        'closeFormBeforeCustomButtons' => true,
        'buttons' => 
        array (
          0 => 'EDIT',
          1 => 'DELETE',
          2 => 
          array (
            'customCode' => '<input id="MonthlyQuote" title="Monthly Quote" class="button" type="button" 
                        name="Quote Payment" value="Quote Payment" onclick="alert(\'How to change status :(\')">',
          ),
        ),
        'footerTpl' => 'modules/UA_Quotes/tpls/DetailViewFooter.tpl',
      ),
      'maxColumns' => '2',
      'widths' => 
      array (
        0 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
        1 => 
        array (
          'label' => '10',
          'field' => '30',
        ),
      ),
      'useTabs' => false,
      'tabDefs' => 
      array (
        'LBL_EDITVIEW_PANEL2' => 
        array (
          'newTab' => false,
          'panelDefault' => 'expanded',
        ),
      ),
    ),
    'panels' => 
    array (
      'lbl_editview_panel2' => 
      array (
        0 => 
        array (
          0 => 'name',
          1 => 
          array (
            'name' => 'ua_contracts_ua_quotes_1_name',
          ),
        ),
        1 => 
        array (
          0 => 
          array (
            'name' => 'monthlystart_c',
            'label' => 'LBL_MONTHLYSTART',
          ),
          1 => 
          array (
            'name' => 'quote_stage',
            'studio' => 'visible',
            'label' => 'LBL_QUOTE_STAGE',
          ),
        ),
        2 => 
        array (
          0 => 
          array (
            'name' => 'monthlydeadline_c',
            'label' => 'LBL_MONTHLYDEADLINE',
          ),
        ),
      ),
    ),
  ),
);
?>

 

Help would always appreciated! Thank you!

 

I'm using sugarCE 6.5, Thanks again!

Outcomes