Page MenuHomePhabricator

Validate action parameters client-side
Open, NormalPublic

Description

Right now it's possible to select an action without specifying any parameter. Specifically, this is possible for "throttle" (just leave the fields blank), "warn" (select "other message" and leave the field blank) and "tag" (blank field) options. I think those fields should be required and validated server-side as well, if their checkbox is selected. My proposal is to wait for OOUI conversion (T132284), then add the needed validation. In fact, with OOUI some field types will be changed and would require a brand new validation system.

Another thing is to avoid validation for hidden fields, see T203336#4551702.

  • Throttle field
  • Warn field
  • Disallow field
  • Tag field
  • No validation for hidden fields

Event Timeline

Daimona created this task.Jun 12 2018, 11:51 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 12 2018, 11:51 AM
Daimona triaged this task as Low priority.Jun 12 2018, 11:52 AM
Daimona moved this task from Backlog to Management features on the AbuseFilter board.

@Volker_E Are you aware of a way to dynamically toggle the required attribute for OOUI fields? I mean, I can't set them required from PHP, otherwise they'd be required even if they're hidden. I could write a JS function to toggle the "required" if the field is shown, but this way we need to infuse every field and keep track of it. Is there a quicker way? Something that you can set from PHP and automatically determines whether the requirement should be applied with JS. Specifically, I'm thinking to something similar to HTMLForm's "hide-if".

Vvjjkkii renamed this task from Make action parameters required if the checkbox is selected to j7aaaaaaaa.Jul 1 2018, 1:04 AM
Vvjjkkii raised the priority of this task from Low to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
Daimona renamed this task from j7aaaaaaaa to Make action parameters required if the checkbox is selected.Jul 1 2018, 10:12 AM
Daimona lowered the priority of this task from High to Low.
Daimona updated the task description. (Show Details)
Daimona added a subscriber: Aklapper.
Daimona renamed this task from Make action parameters required if the checkbox is selected to Validate action parameters client-side.Sep 2 2018, 12:37 PM
Daimona raised the priority of this task from Low to Normal.
Daimona updated the task description. (Show Details)

Change 457445 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] [WIP] Add client-side validation for action parameters

https://gerrit.wikimedia.org/r/457445

Daimona claimed this task.Sep 3 2018, 1:38 PM

@Volker_E As stated in the commit message, I can't seem to find a setRequired method for TagMultiselect and CheckboxMultiselect. Is this intended, or they still have to be added?

Daimona updated the task description. (Show Details)Sep 3 2018, 5:04 PM
Daimona updated the task description. (Show Details)Oct 12 2018, 2:27 PM