OpenTreeMap / otm-core

OpenTreeMap is a collaborative platform for crowdsourced tree inventory, ecosystem services calculations, urban forestry analysis, and community engagement.
www.opentreemap.org
Other
186 stars 88 forks source link

Add client-side validation to prevent extra udf choice whitespace #3262

Closed jwalgran closed 5 years ago

jwalgran commented 5 years ago

Overview

Leading or trailing whitespace cannot be easily seen, but causes problems matching values. This change follows the pattern of other client-side choice validations.

Connects https://github.com/OpenTreeMap/otm-clients/issues/442

Demo

screen shot 2018-11-06 at 11 21 45 am

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Testing Instructions

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 83.796% when pulling 8fb54bdfb2c3a610a61d0e98cef42fa4440f85d9 on jcw/udf-choice-whitespace into fde881fb374f60729dba2f5edfa42408e4f06df5 on hotfix/2.21.4.

jwalgran commented 5 years ago

Thanks. I was focued on editing existing fields and overlooked the new field dialog.

I intentionally did not dig into validating existing fields that may have whitespace issues to keep the scope of the change small and because we are planning on cleaning up existing data via scripting.

jwalgran commented 5 years ago

I added a FIXUP commit to properly disable the button on the new choice field dialog when there is a client side validation error.

jwalgran commented 5 years ago

Thanks for the thorough review.