views:

1580

answers:

4

Hi,

Is there any code or custom options available to achieve the following :

1> When an error occurs in a text box, the validation shows the error. Enforces / Forces the user to remove the error and only then proceed to complete remaining text inputs. KEEPS the mouse focus on the Text Box.

I have used built in mx:Validator tags, but it does not enforce user to remove error. Instead, user can easily go ahead without rectifying the error.

2> Can the error message which generally appears as Tool tip when mouse focus moves over the text input with error, REMAIN until the user removes error and not just be displayed on mouse hover action ??

A: 

For #2, check out http://aralbalkan.com/1125.

Unfortunately, it is a lot of hassle if you have multiple/large forms. It is unfortunate flex doesn't provide more styling options for the error tooltip.

#1 seems to be a bad UI design. While you may not allow them to submit a form unless they enter valid information, they should be able to navigate around the form freely and fill in the information as they choose. Just my opinion.

Chetan Sastry
I agree with you for the error hassle....Well, at present I am allowing the user to freely navigate through the form.....But, I somehow was checking out any option for onFocus and similar functions in flex, like the ones available in javascript.
Another thing I was thinking of was using flag to and see the statud of the flag if all errors sorted or not. Other option was to use counter, but the problem is that if you make same error twice, counter increments twice and then while decrementing creates trouble. Any idea of how to ensure that all errors are sorted before allowing user to SUBMIT form ??
i DID CHECK OUT THE http://aralbalkan.com/1125. LINK. But, I am not getting any code that works correctly. If you a code similar to one mentioned in the link, it will be very helpful.
The link does not have a proper application and code, and the individual parts though get compiled, the error messages and tool-tips do not occur.
A: 

A solution to question 1) is as follows; Use the Validator.validateAll static method to check that all form items are valid before allowing the form to be submitted. The following snippet is taken from a good flex example which shows this

private function resetForm() :void
{
    btnLogin.enabled = false;
}
private function validateUs() :void
{
    btnLogin.enabled = (Validator.validateAll([val1,val2]).length == 0);
}

The complete example is here http://idletogether.com/easy-form-validation-and-submit-button-enable-disable-in-flex-3/

Phil C
I will check this out and see if it works for the large form.
It says.. "Access of Undefined property Validator" ........ Any solution ??
For the above part 2, the error is resolved.
Any idea for the continous tool-tip problem ? i.e. Part 1 answer.
I would like to accept your answer for the time you took in answering the same. But, am not able to accept two answers for the same question. If you would like, I can create a new question, where you can answer this and I will accept the same. Please reply.
A: 

OK. If you create another question I will answer. There doesn't seem to be any way to PM or IM on this site

Phil C