Programming Guide



sm_*validate

Forces validation for the specified object

int sm_validate(int obj_id);
int sm_n_validate(char *widget_name);

obj_id
Object ID of the widget or screen to be validated, obtained from sm_prop_id

widget_name
The name of the widget to validate. For fields, an occurrence number or element number can be included. For example, sm_n_validate "field[[3]]") causes the third element of the named field to be validated.

Returns

Description

sm_validate causes the specified widget or screen to be validated. The specified widget must be on the current screen.

The widget must be one of the following types:

Validation stops when a field fails validation or when a validation function returns a non-zero value. See sm_fval for more about field validation and sm_s_val for more about screen validation.

Example

#include <smdefs.h>

/* Call a grid validation function and return if it fails.
*/

int
validate (fieldnum, data, occurrence, bits)
int fieldnum, occurrence, bits;
char *data;
{
if (sm_n_validate("grid1")

{
/* Stop processing if grid validation function fails */
return 1;
}
...
}

See Also

sm_fval, sm_n_gval, sm_s_val