Is there a way to add a hidden field in the edit view of a custom module in Sugar Pro 6

5.9k views Asked by At

Is there a way to add a hidden field in the edit view of a custom module in Sugar Pro 6 and then assign a value to that field and use that value in the before_save logic hook by obtainig it via REQUEST variable for example $_REQUEST['hiddenfieldname'].

Any help will be appreciated!

2

There are 2 answers

2
Cédric Mourizard On BEST ANSWER

You could use the "hidden" entry in the editviewdefs metadata like that :

    $viewdefs ['ModuleName'] =
array (
  'EditView' =>
  array (
    'templateMeta' =>
    array (
      'maxColumns' => '2',
      'form' =>
      array (
        'hidden' =>
        array (
          0 => '<input type="hidden" name="MyFiedlName" id="MyFiedlName" value="MyFieldValue">',
        ),
        'buttons' =>
        array (
1
Alfonso De Anselmo Vázquez On

try this on your input item definition: value="{$smarty.request.MyFiedlName}"