mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-17 21:00:45 +00:00
QQQ-21: fixed isRequired being double checked
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
"no-shadow": "off",
|
||||
"no-unused-vars": "off",
|
||||
"spaced-comment": "off",
|
||||
"object-shorthand": "off",
|
||||
"react/jsx-props-no-spreading": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"import/extensions": [
|
||||
|
@ -70,7 +70,6 @@ function QDynamicForm(props: Props): JSX.Element {
|
||||
return (
|
||||
<Grid item xs={12} sm={6} key={fieldName}>
|
||||
<FormField
|
||||
required={field.isRequired}
|
||||
type={field.type}
|
||||
label={field.label}
|
||||
name={fieldName}
|
||||
|
@ -19,8 +19,10 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// misc imports
|
||||
import * as Yup from "yup";
|
||||
|
||||
// qqq imports
|
||||
import { QFieldMetaData } from "@kingsrook/qqq-frontend-core/lib/model/metaData/QFieldMetaData";
|
||||
import { QFieldType } from "@kingsrook/qqq-frontend-core/lib/model/metaData/QFieldType";
|
||||
|
||||
@ -55,9 +57,12 @@ class DynamicFormUtils {
|
||||
fieldType = "text";
|
||||
}
|
||||
|
||||
let label = field.label ? field.label : field.name;
|
||||
label += field.isRequired ? " *" : "";
|
||||
|
||||
dynamicFormFields[field.name] = {
|
||||
name: field.name,
|
||||
label: field.label ? field.label : field.name,
|
||||
label: label,
|
||||
isRequired: field.isRequired,
|
||||
type: fieldType,
|
||||
// todo invalidMsg: "Zipcode is not valid (e.g. 70000).",
|
||||
|
@ -91,19 +91,16 @@ function ProcessRun(): JSX.Element {
|
||||
setActiveStep(activeStep);
|
||||
setFormId(activeStep.name);
|
||||
|
||||
const { dynamicFormFields, formValidations } = DynamicFormUtils.getFormData(
|
||||
activeStep.formFields
|
||||
);
|
||||
|
||||
const formFields: any = {};
|
||||
const initialValues: any = {};
|
||||
const validations: any = {};
|
||||
|
||||
activeStep.formFields.forEach((field) => {
|
||||
// todo - not working - also, needs real value.
|
||||
initialValues[field.name] = "Hi";
|
||||
});
|
||||
|
||||
const { dynamicFormFields, formValidations } = DynamicFormUtils.getFormData(
|
||||
activeStep.formFields
|
||||
);
|
||||
|
||||
setFormFields(dynamicFormFields);
|
||||
setInitialValues(initialValues);
|
||||
setValidations(Yup.object().shape(formValidations));
|
||||
|
Reference in New Issue
Block a user