Click to See Complete Forum and Search --> : onblur event


glotsa
04-03-2003, 12:58 AM
In my form, there are two types of questions.
1st type: one input field is provided. user can choose whether they fill in score or not.
2nd type: two input fields are provided. User can either fill in both or not fill in both

For example:
Q1: one input field
Q2: one input field
Q3: two input fields

Now i input the first input field in Q3, after that if i point to the input field in Q1 or Q2, alert message will be poped up to tell user either fill in both or not fill in both.
But if i point to the second input field in Q3 after filled the first input field, no alert message will be poped up.
How to do that??

glotsa
04-07-2003, 03:15 AM
I know what you mean and know that it will work on this situation.
However, on the other hand, the input value is restricted to be only an integer. So, i am using onblur event on each question to validate the input value and set focus to the input field invalid value.

If i dun use event on question 3, then, i cannot do the valiatation.

glotsa
04-07-2003, 10:14 PM
ic...that's really a problem when using onblur event.

um.....as you said, using onfocus for Q1 and Q2, when this Q1 or Q2 receive focus, then check two fields at Q3.
But can i know that the focus is receieved from the field at Q3??

glotsa
04-07-2003, 11:07 PM
In fact, my form is generated dynamically. Let's say, in some cases, there will be more questions like Q3 in the form.

for example if my form is generated like this:
Q1: fieldname1 onFocus="check()"
Q2: fieldname2 onFocus="check()"
Q3: Ffieldname3, fieldname3
Q4: fieldname4 onFocus="check()"
Q5: Ffieldname5, fieldname5
Q6: fieldname6 onFocus="check()"

If user fill in Q3 first, and then Q1, in the check() function, i would like to check the focus is from which question, Q3 or Q5. So, i think i need to.

glotsa
04-09-2003, 08:44 PM
Thank you very much. I can solve the problem :D