Function
useForm
({
action,
resource,
onMutationSuccess: onMutationSuccessProp,
onMutationError: onMutationErrorProp,
autoSave,
submitOnEnter = false,
warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
redirect,
successNotification,
errorNotification,
meta,
metaData,
queryMeta,
mutationMeta,
liveMode,
liveParams,
mutationMode,
dataProviderName,
onLiveEvent,
invalidates,
undoableTimeout,
queryOptions,
createMutationOptions,
updateMutationOptions,
id: idFromProps,
overtimeOptions,
optimisticUpdateMap,
defaultFormValues,
disableServerSideValidation: disableServerSideValidationProp = false,
}: UseFormProps<
TQueryFnData,
TError,
TVariables,
TData,
TResponse,
TResponseError
> = {})
Source from the content-addressed store, hash-verified
| 98 | * |
| 99 | */ |
| 100 | export const useForm = < |
| 101 | TQueryFnData extends BaseRecord = BaseRecord, |
| 102 | TError extends HttpError = HttpError, |
| 103 | TVariables = {}, |
| 104 | TData extends BaseRecord = TQueryFnData, |
| 105 | TResponse extends BaseRecord = TData, |
| 106 | TResponseError extends HttpError = TError, |
| 107 | >({ |
| 108 | action, |
| 109 | resource, |
| 110 | onMutationSuccess: onMutationSuccessProp, |
| 111 | onMutationError: onMutationErrorProp, |
| 112 | autoSave, |
| 113 | submitOnEnter = false, |
| 114 | warnWhenUnsavedChanges: warnWhenUnsavedChangesProp, |
| 115 | redirect, |
| 116 | successNotification, |
| 117 | errorNotification, |
| 118 | meta, |
| 119 | metaData, |
| 120 | queryMeta, |
| 121 | mutationMeta, |
| 122 | liveMode, |
| 123 | liveParams, |
| 124 | mutationMode, |
| 125 | dataProviderName, |
| 126 | onLiveEvent, |
| 127 | invalidates, |
| 128 | undoableTimeout, |
| 129 | queryOptions, |
| 130 | createMutationOptions, |
| 131 | updateMutationOptions, |
| 132 | id: idFromProps, |
| 133 | overtimeOptions, |
| 134 | optimisticUpdateMap, |
| 135 | defaultFormValues, |
| 136 | disableServerSideValidation: disableServerSideValidationProp = false, |
| 137 | }: UseFormProps< |
| 138 | TQueryFnData, |
| 139 | TError, |
| 140 | TVariables, |
| 141 | TData, |
| 142 | TResponse, |
| 143 | TResponseError |
| 144 | > = {}): UseFormReturnType< |
| 145 | TQueryFnData, |
| 146 | TError, |
| 147 | TVariables, |
| 148 | TData, |
| 149 | TResponse, |
| 150 | TResponseError |
| 151 | > => { |
| 152 | const { options } = useRefineContext(); |
| 153 | const disableServerSideValidation = |
| 154 | options?.disableServerSideValidation || disableServerSideValidationProp; |
| 155 | |
| 156 | const translate = useTranslate(); |
| 157 | |