Craig100
03/28/2024, 2:08 PMLewis Heaton
03/28/2024, 2:24 PMLewis Heaton
03/28/2024, 2:28 PM{
  "javascript": [
    "~/App_Plugins/FormBlockView/formBlock.controller.js"
  ]
}
This points to your controller page, that looks something like this:
angular.module("umbraco").controller("formBlockController", function ($scope, formResource) {
  const data = $scope.block.data;
  console.info({ data, formResource });
  const amendData = () => {
    if (data.form) {
      formResource.getByGuid(data.form).then(response => {
        console.info({ response });
        const fields = [];
        let fieldsText;
        let totalPages = 0;
        response.data.pages.forEach(page => {
          totalPages++;
          page.fieldSets.forEach(fieldset => {
            fieldset.containers.forEach(container => {
              container.fields.forEach(field => {
                fields.push(field.caption);
              });
            });
          });
        });
        const fieldsToDisplay = 3;
        fieldsText = fields.slice(0, Math.min(fields.length, fieldsToDisplay)).join(", ");
        if (fieldsToDisplay < fields.length) {
          fieldsText += ` + ${fields.length - fieldsToDisplay} more`
        }
        $scope.name = response.data.name;
        $scope.fields = fieldsText
        $scope.pages = totalPages === 1 ? `${totalPages} page` : `${totalPages} pages`;
      });
    }
  };
  amendData();
  $scope.$watch("block.data", amendData, true);
});
(Note in the example above, we do some magic around outputting the form item captions)Lewis Heaton
03/28/2024, 2:29 PM<div ng-controller="formBlockController" style="border: 1px solid #ccc; padding: 10px;">
    <div><strong>{{ name }}</strong></div>
    <div style="font-size: .95em">
        <div style="padding-top: .5em;">{{ fields }}</div>
        <div style="padding-top: .5em; color: #999;">{{ pages }}</div>
    </div>
</div>
Your folder structure will look like this:
https://cdn.discordapp.com/attachments/1222910232204673095/1222915516314816612/image.png?ex=6617f3d3&is=66057ed3&hm=4b82b92dbca4745b26569caf5a5919c4a3bac829115b0d99c721ccdf28184d98&Lewis Heaton
03/28/2024, 2:31 PMif(data.form), form in this case is the alias of my form picker on the block, so update this to be whatever you haveLewis Heaton
03/28/2024, 2:32 PMCraig100
03/28/2024, 2:33 PMLewis Heaton
03/28/2024, 2:35 PMCraig100
03/28/2024, 2:49 PM<div>
    @await Component.InvokeAsync("RenderForm", new { formId = @Model.Content.FormPicker.Value, theme = "default", includeScripts = false })
</div>Craig100
03/28/2024, 3:43 PMA hub and casual space for you to interact with fellow community members and learn more about Umbraco!
Powered by