rjsf-team / react-jsonschema-form

A React component for building Web forms from JSON Schema.
https://rjsf-team.github.io/react-jsonschema-form/
Apache License 2.0
14.41k stars 2.2k forks source link

<title> disable SUBMIT button when no changes AND handle units of measure #4098

Open dberardo-com opened 9 months ago

dberardo-com commented 9 months ago

Prerequisites

What theme are you using?

mui

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

disable submit when no changes

this could be a global prop on the Form, that upon first submit, the form memorizes the formData upon submit and disables submit button if the formData comes back to the last submitted value

--> related feature: add a RESET button to reset to the latest submtited value (or default initial values in case no submission yet)

UoMs

it would be nice if the json schema could be extended to support unit of measure for the single params, this could be particularly helpful for currency values, but not only that.

in particular in MUI would be nice to use a "endAdornment" in the input field that includes the unit of measure.

--> related feature: add uspport for currency formatting widget using 2 decimal places and tousands comma/point separator

Describe alternatives you've considered

No response

heath-freenome commented 9 months ago

@dberardo-com Give the highly configurable nature of RJSF, you can do all of what you want in your own implementations. You can control how the Submit button is displayed in several ways, either using the uiSchema submitButtonOptions or replacing the default submit button (and adding others) via the children property of the Form. And you can also create/extend the BaseInputTemplate you use to support UoMs.

All that being said, we love getting new features provided by the community.

robbieculkin commented 4 months ago

Relating to UoMs: what's the best way to communicate which unit the form should render? It seems to me that this information wouldn't belong in the JSON schema but rather the UI schema. Once in the UI schema, how can my template component access this unit information to be rendered?

heath-freenome commented 4 months ago

@robbieculkin All templates are given the uiSchema that is associated with the level in the hierarchy. Please checkout the documentation for more info. Also, you can use the ui:globalOptions to stash information you want all templates to be able to access.