Form fields only visible to logged in users

Silverstripe Version: 3.7

Question: How can I make form fields visible?

I have created a page in the CMS, type User Defined Form, and added some form fields. The form, but not the fields, are visible to non-logged-in users (i.e. only a submit button shows, and any email submission is blank (with no validation). All appears perfectly to logged-in users. How can I make the form fields visible to anyone?
This is a top level page, with Show in Menus unticked.
All other elements of the page (i.e. content) are visible.
A contact us type page I created years ago shows up perfectly well, also set as a User Defined Form.

Many thanks
Ed

Hi Ed,

I don’t see from the top of my head why form fields would show only when users are logged in. There’s 3 things you can do for further help:

  • Check if there’s a CSS class somewhere with a condition that hides the form like .not-logged{display: none;} that affects only the form fields
  • Check if the template uses something like <% if CurrentMember %> though if that was it, why would you have the submit button by itself?
  • Add SS_ERROR_LOG="./silverstripe.log" to your .env and check if there’s anything in the corresponding silverstripe.log files that would show any warning or error preventing the fields to be generated

Most likely there’s something in your form like a call to $Member or $CurrentUser, whatever it is, that if not present would be a call to a null object. And obviously you can always share a snippet of code, without it the best we can do is guess work.

Gaets (Digitweaks)