roberthpike
04-09-2003, 02:24 PM
Hey All,
Heres something I found wrong and I was wondering if someone could explain to me how the heck this happens.
1 text box, 1 select list (after the text field)
On blur event for text field checks to see if it has a null value. If it does it needs to get focus again before going anywhere else. Right now it checks it in a javascript if it is null and then does a focus() to get back if its null.
On the blur event for the select list it does the same thing except it checks to see if the item selected is not 0.
Currently inside each if (for text box if its null and for select list if is has the 0 or no item selected) it displays a message using alert. When tabbing through the elements, the text box is hit and then the select list should be hit but this is what happens if nothing is entered anywhere.
==================================
alert for select list is triggered
then the text box alert is triggered
and then 2 consecutive alerts for the select list is triggered
==================================
In the code for the text box's onBlur it does this :
==================================
check the value, if null then
display the alert
set focus back to the text box using the focus method
then set the value of the text box to something other than null (in this case the current date)
==================================
How could the alert for the select list occur before the text box alert when the onBlur for the text box occurs before the select list? Where does the onBlur occur? Before actually hitting the select list, after hitting it? If it happens afterwards is there an alternative to the method I mentioned above?
If the two are empty (text box and select list) then leaving the text box will setfocus back to the text box, which will then send the onBlur on the select list into play, which will then trigger the focus method for the select list, then the onBlur for the text box happens all over again. Is there a method that happens before onBlur that might be useful? Recently the return <whatever value came from the script> was used in the onBlur but that didnt seem to work either. Thanks for any feedback on this.
Rob
Heres something I found wrong and I was wondering if someone could explain to me how the heck this happens.
1 text box, 1 select list (after the text field)
On blur event for text field checks to see if it has a null value. If it does it needs to get focus again before going anywhere else. Right now it checks it in a javascript if it is null and then does a focus() to get back if its null.
On the blur event for the select list it does the same thing except it checks to see if the item selected is not 0.
Currently inside each if (for text box if its null and for select list if is has the 0 or no item selected) it displays a message using alert. When tabbing through the elements, the text box is hit and then the select list should be hit but this is what happens if nothing is entered anywhere.
==================================
alert for select list is triggered
then the text box alert is triggered
and then 2 consecutive alerts for the select list is triggered
==================================
In the code for the text box's onBlur it does this :
==================================
check the value, if null then
display the alert
set focus back to the text box using the focus method
then set the value of the text box to something other than null (in this case the current date)
==================================
How could the alert for the select list occur before the text box alert when the onBlur for the text box occurs before the select list? Where does the onBlur occur? Before actually hitting the select list, after hitting it? If it happens afterwards is there an alternative to the method I mentioned above?
If the two are empty (text box and select list) then leaving the text box will setfocus back to the text box, which will then send the onBlur on the select list into play, which will then trigger the focus method for the select list, then the onBlur for the text box happens all over again. Is there a method that happens before onBlur that might be useful? Recently the return <whatever value came from the script> was used in the onBlur but that didnt seem to work either. Thanks for any feedback on this.
Rob