GNU Info

Info Node: (forms)Modifying Forms Contents

(forms)Modifying Forms Contents


Next: Miscellaneous Prev: Format Description Up: Top
Enter node , (file) or (file)node

Modifying The Forms Contents
****************************

   If `forms-read-only' is `nil', the user can modify the fields and
records of the database.

   All normal editing commands are available for editing the contents
of the displayed record.  You cannot delete or modify the fixed,
explanatory text that comes from string formatting elements, but you
can modify the actual field contents.

   If the variable `forms-modified-record-filter' is non-`nil', it is
called as a function before the new data is written to the data file.
The function receives one argument, a vector that contains the contents
of the fields of the record.

   The function can refer to fields with `aref' and modify them with
`aset'.  The first field has number 1 (one); thus, element 0 of the
vector is not used.  The function should return the same vector it was
passed; the (possibly modified) contents of the vector determine what is
actually written in the file.  Here is an example:

     (defun my-modified-record-filter (record)
       ;; Modify second field.
       (aset record 2 (current-time-string))
       ;; Return the field vector.
       record)
     
     (setq forms-modified-record-filter 'my-modified-record-filter)

   If the variable `forms-new-record-filter' is non-`nil', its value is
a function to be called to fill in default values for the fields of a
new record.  The function is passed a vector of empty strings, one for
each field; it should return the same vector, with the desired field
values stored in it.  Fields are numbered starting from 1 (one).
Example:

     (defun my-new-record-filter (fields)
       (aset fields 5 (login-name))
       (aset fields 1 (current-time-string))
       fields)
     
     (setq forms-new-record-filter 'my-new-record-filter)


automatically generated by info2www version 1.2.2.9