appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.64k stars 3.74k forks source link

[Bug]: No error thrown if widget is set as Required and no option is selected #15391

Open shadabbuchh opened 2 years ago

shadabbuchh commented 2 years ago

Is there an existing issue for this?

Description

The Select widget family does not throw any error if the Required property is enabled and no option(s) is selected.

https://www.loom.com/share/04fc54ec17b543b386e78937d4378ea7

Steps To Reproduce

  1. D&D any widget from the Select Family.
  2. Enable the Required property.
  3. No delete the text in the Default Value property.

Expected: An error should be thrown.

Public Sample App

No response

Version

Cloud

daaliachhak17 commented 3 months ago

created a ticket on Jira-https://zemoso.atlassian.net/browse/TNOSB-390

SaiCharanChetpelly31 commented 3 months ago

HI @shadabbuchh @somangshu @Nikhil-Nandagopal I am picking this issue. Approach: I will add a new validation check in the following location:https://github.com/appsmithorg/appsmith/blob/351acde961d97bcf0b39c537563edd6fcb35ebb8/app/client/src/widgets/SelectWidget/widget/propertyUtils.ts#L41 If the value is empty and isRequired is true, I will raise a new ValidationError with the message: "Default value cannot be empty."

What are your thoughts on this? Please let me know if anything else needs to be addressed.