MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / _disableForm

Function _disableForm

src/logic/createFormControl.ts:1371–1392  ·  view source on GitHub ↗
(disabled?: boolean)

Source from the content-addressed store, hash-verified

1369 iterateFieldsByAction(_fields, _focusInput, _names.mount);
1370
1371 const _disableForm = (disabled?: boolean) => {
1372 if (isBoolean(disabled)) {
1373 _subjects.state.next({ disabled });
1374 iterateFieldsByAction(
1375 _fields,
1376 (ref, name) => {
1377 const currentField: Field = get(_fields, name);
1378 if (currentField) {
1379 ref.disabled = currentField._f.disabled || disabled;
1380
1381 if (Array.isArray(currentField._f.refs)) {
1382 currentField._f.refs.forEach((inputRef) => {
1383 inputRef.disabled = currentField._f.disabled || disabled;
1384 });
1385 }
1386 }
1387 },
1388 0,
1389 false,
1390 );
1391 }
1392 };
1393
1394 const handleSubmit: UseFormHandleSubmit<TFieldValues, TTransformedValues> =
1395 (onValid, onInvalid) => async (e) => {

Callers

nothing calls this directly

Calls 1

iterateFieldsByActionFunction · 0.85

Tested by

no test coverage detected