Page MenuHomePhabricator

PageForms: Hidden mandatory fields without defaults can keep the user from submitting the form without any error message
Open, Needs TriagePublic

Description

Example form:

<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|confirm|input type=text|input type=radiobutton|values=No,Yes|default=No|show on select=Yes=>Confirm|mandatory}}}
<div id=Confirm>
{{{field|review|input type=radiobutton|values=maybe,maybe not|mandatory|restricted=YouAreNOTinThisGroup}}}
</div>
</includeonly>

When the user does not select "Yes" but tries to submit the form, the form re-appears without an indication of what is wrong.

When the user selects "Yes" and tries to save, they see the error There were errors with your form input; see below. and, below, "None" is selected and greyed out ( T231957: PageForms: Should allow user to submit a form if there are restricted mandantory fields without defaults that the user cannot fill) and, beneath that, cannot be blank is displayed in red text.

Event Timeline

Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptSep 4 2019, 1:36 AM

Yes, that's not ideal... what do you think the behavior should be, if there are mandatory-but-not-visible fields that are left blank?

I think this problem can be resolved by not doing error checking on
hidden fields. If they are hidden, the user hasn't had a chance to see
them.

If there is a default value, I think it should be saved when the form is
submitted (though I can see an argument against that), but, otherwise,
the hidden fields should not affect the user's experience.

That seems like the right approach, yes. I think someone else made that request too recently, but I can't remember where. Hopefully this is easy to do.