Validation Functions for Memo and Tickertape Memo Fields

Field validation functions for memo and tickertape fields also accept three parameters. The first parameter points to the memory file used by the memo. The second parameter is simply a placeholder and points to no meaningful data. The third parameter points to the form being processed.

Do not change or attempt to access the contents of the memory file. To get the current contents of the memo field, you must call the function fld_get() to get the converted value of the field, as described later in this chapter.

Caution: do not attempt to use the underlying data variable as the value of the field contents. The data variable is not updated until after field validation is successfully completed. Even if the FORCECONVERT field option is ON for the field, the data variable is not updated until after the validation function(s) and end-field function are called.

The call for a user validation function for a memo field is as follows:

int vf_user(mfp, dumptr, dfmp)
 
MFILEPTR mfp;
/* Pointer to the memory file structure associated with the memo
*/
PTR dumptr;
/* Dummy pointer 
*/
DFORMPTR dfmp;
/* Pointer to processed form
*/

Your validation function should return a TRUE if the field is valid. If the field is not valid, your function should return FALSE and set the value of the global variable VAL_ERR to an appropriate value.

VAL_ERR is the global validation error variable. If VAL_ERR is set to a non-zero value, Vermont Views displays the error window and prints the appropriate error message. You can use one of the system error messages in your validation function, or you can create your own validation error message. You will find more information on using the validation error messages and creating your own messages later in this chapter.


Home Contents Previous Next