XForms: Input validation problem

Ian Leonard (ian@eonsw.demon.co.uk)
Sun, 13 Sep 1998 21:06:44 +0100 (BST)

# To subscribers of the xforms list from Ian Leonard <ian@eonsw.demon.co.uk> :

Greetings,

I have a form with two input boxes and I want the input to be validated when
data entry has been completed. I use an input filter. When invalid data is
entered and I have clicked on the second input box, the filter is called with
the 'newly typed character' set to zero (as per the manual). I return
FL_INVALID|FL_RINGBELL and focus remains in the first input field. This is
correct and what I want. But...

1. If there is text in the second input field, it gets selected when clicked on

2. If I click on the second box again, the focus is lost

3. If the field is blank ( and therefore invalid) and no characters are pressed
the validation is not called (same as problem 2 I would guess)

I have appended a small program that shows the problem.

TIA

-- 
Ian

Ian Leonard eMail: ian@eonsw.demon.co.uk Phone Fax: +44 (0)1865 434757 Fax: +44 (0)1865 434758 19 Stapleton Road Headington, Oxford, OX3 7LX, UK

Please ignore spelling and punctuation - I did.

--

#include "forms.h" #include <stdlib.h>

int input_filter (FL_OBJECT *ob, const char *old, const char *cur, int c);

int main(int argc, char *argv[]) { FL_OBJECT *o1, *o2; FL_FORM *f;

fl_initialize(&argc, argv, 0, 0, 0);

f = fl_bgn_form(FL_NO_BOX, 441, 441); fl_add_box(FL_UP_BOX,0,0,441,441,"");

o1 = fl_add_input(FL_NORMAL_INPUT,40,40,340,30,"O1"); o2 = fl_add_input(FL_NORMAL_INPUT,40,80,340,30,"O2");

fl_set_input_filter ( o1, input_filter); fl_set_input_filter ( o2, input_filter);

fl_set_input ( o2, "test");

fl_end_form();

fl_show_form ( f, FL_PLACE_CENTERFREE,FL_FULLBORDER,"input");

while (fl_do_forms()) ;

return 0; }

int input_filter ( FL_OBJECT *ob, const char *old, const char *cur, int c) { printf ( "(%s)(%s) %d\n", old, cur, c);

if ( c) return FL_VALID;

return FL_INVALID|FL_RINGBELL; }

_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html XForms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/