1. Component Guide
  2. Form fieldset
  3. With error message
Form fieldset example

With error message

The component also accepts an error_id, or generates one automatically.

How it looks (preview)

Do you have a passport?

Error: Please choose an option

How to call this example

<%= render "govuk_publishing_components/components/fieldset", {
  legend_text: "Do you have a passport?",
  error_message: "Please choose an option"
} do %>
  <!-- example content -->
  <%= render "govuk_publishing_components/components/radio", {
    name: "default2",
    items: [
      {
        value: "default2-yes",
        text: "Yes"
      },
      {
        value: "default2-no",
        text: "No"
      }
    ]
  } %>
  <!-- end of example content -->
<% end %>