sugarcrmhidden-fieldeditview

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


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!


Solution

  • 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 (