---
name: "form_hook"
section: "3x"
platform: "macos"
package: "ncurses"
version: "79"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/form_hook/3x"
---

# form\_hook(3x)

set hooks for automatic invocation by applications

## NAME

**form\_hook** - set hooks for automatic invocation by applications

## SYNOPSIS

**#include \<form.h\>**\
 int set\_field\_init(FORM \*form, Form\_Hook func);\
 Form\_Hook field\_init(const FORM \*form);\
 int set\_field\_term(FORM \*form, Form\_Hook func);\
 Form\_Hook field\_term(const FORM \*form);\
 int set\_form\_init(FORM \*form, Form\_Hook func);\
 Form\_Hook form\_init(const FORM \*form);\
 int set\_form\_term(FORM \*form, Form\_Hook func);\
 Form\_Hook form\_term(const FORM \*form);\

## DESCRIPTION

These functions make it possible to set hook functions to be called at various points in the automatic processing of input event codes by **form\_driver**.

The function **set\_field\_init** sets a hook to be called at form-post time and each time the selected field changes (after the change).  **field\_init** returns the current field init hook, if any (**NULL** if there is no such hook).

The function **set\_field\_term** sets a hook to be called at form-unpost time and each time the selected field changes (before the change).  **field\_term** returns the current field term hook, if any (**NULL** if there is no such hook).

The function **set\_form\_init** sets a hook to be called at form-post time and just after a page change once it is posted.  **form\_init** returns the current form init hook, if any (**NULL** if there is no such hook).

The function **set\_form\_term** sets a hook to be called at form-unpost time and just before a page change once it is posted.  **form\_init** returns the current form term hook, if any (**NULL** if there is no such hook).

## RETURN VALUE

Routines that return pointers return **NULL** on error.  Other routines return one of the following:

- **E\_OK**

  The routine succeeded.

- **E\_SYSTEM\_ERROR**

  System error occurred (see **errno**).

## SEE ALSO

**curses**(3X), **form**(3X).

## NOTES

The header file **\<form.h\>** automatically includes the header file **\<curses.h\>**.

## PORTABILITY

These routines emulate the System V forms library.  They were not supported on Version 7 or BSD versions.

## AUTHORS

Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S. Raymond.
