Page MenuHomePhabricator

PageForms: Should allow user to submit a form if there are restricted mandantory fields without defaults that the user cannot fill
Closed, DeclinedPublic

Description

The following defines a form that no user will be able to fill complete except in the unlikely chance that they are in the group no-one-is-in-this:

<noinclude>This is a simple form.
{{#formlink:form=Simple|link text=Test|link type=button|new window}} 
</noinclude><includeonly>
{{{info|page name=<unique number>}}}
{{{field|text|input type=text|mandatory|restricted=no-one-is-in-this}}}
</includeonly>

This is because the text field is mandatory, restricted to users in the no-one-is-in-this group, and has no default.

As I see it, there are three solutions to this problem:

  1. Leave things the way they are so people get frustrated when they run into this problem,
  2. Catch the problem when they try to create a form that has a restricted field that is mandatory, but does not specify a default, or
  3. Assume null when the user doesn't have permission and only enforce "mandatory" when the person has permission to modify the form?

Implementing the third solution makes sense to me.

Event Timeline

MarkAHershberger renamed this task from PageForms: Allows mandantory fields without defaults that the user cannot fill in to PageForms: Should allow user to submit a form if there are restricted mandantory fields without defaults that the user cannot fill.Sep 4 2019, 1:23 AM

Is it your view that people will never create a field tag on purpose that has "mandatory" and "restricted", but no "default"? If so, I don't know... I haven't heard of someone doing that, but I can imagine that it could theoretically be useful, if only as a way to restrict creation of pages to a specific subset of users.

Is it your view that people will never create a field tag on purpose
that has "mandatory" and "restricted", but no "default"?

No, that is obviously not the case. This error came up because a user
created a field with exactly those characteristics. Older behavior of
PF apparently allowed what they were doing, but, in any case, we ended up
with the situation where there was no default on a field like this.

I can imagine that it could theoretically be useful, if only as a way
to restrict creation of pages to a specific subset of users.

If they want to restrict creation in that way, then it seems more
straightforward to make the entire form restricted.

Allowing a restricted, mandatory field to restrict page creation on that
as the only means to restrict page creation using that form is indirect
and will cause confusion.

I agree that your use case (restrict creation of pages to a specific
subset of users) is valid, but if that is the use case, then it is
better done by restricting the entire form. That would allow users to
see, immediately upon visiting the page, that it is restricted. This
would also allow forms to be used to create work flows that only allow
certain users to fill out certain parts of the form.

I should probably know this, but how do you restrict an entire form?

I'm marking this as "Declined" - if a user isn't allowed to fill out a field that's declared mandatory, then preventing the user from submitting the form seems like correct behavior.