Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
flexbay #1
Form validation error!
Hi ,
I have a form with a text field 'myTxt' and this is an Optional field.
However I have NumberValidator defined for this text field so that it should
accept only numbers if data is entered.
I follow these steps
1) enter text 'ABCD' in 'myTxt' field and submit the form
2) returns an error message - (Yes it should accept only numbers).
3) Delete all the text in myTxt field so that its empty and submit the form
again.
4) returns the message 'This is a required field'.
I am really puzzled by this error since the 'myTxt' field is an OPTIONAL one.
Basically I want the Validator to validate this field only when some text is
available otherwise it should just ignore it.
Any help here would be appreciated.
Thanks.
flexbay Guest
-
CFFORM Validation trumping Custom Form Validation
Is there any way for custom form validation to work in concert with the cfform validation? I have a custom script that compares the values of two... -
form validation in asp.net
I want to verify that a email has been entered in a simple asp.net form that is being sent as an email. I found the RequiredFieldValidator Tag is... -
Optional form paramater validation error
Hi , I have a form with a text field 'myTxt' and this is an Optional field. However I have NumberValidator defined for this text field so that... -
Form field validation states in error
Form fields are showing that they need validatin, ie red and the hover text in red BUt the form has not submitted...i cant seem to fix this. What... -
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome?
I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed... -
Ken D. Nelson #2
Re: Form validation error!
You are probably going to have to create your own validate that accepts "" (Empty String) as a valid value. There is an example of something similar to this in the samples. Look for RequiredField Validator.as
class RequiredFieldValidator extends mx.validators.Validator {
function doValidation(value) : Void {
if (value=="" || value==null ) {
validationError("required", "Required field.");
}
}
}
you would just do the opposite and also add that the value needs to be a number.
Ken
"flexbay" <webforumsuser@macromedia.com> wrote in message news:d36lel$t6o$1@forums.macromedia.com...> Hi ,
>
> I have a form with a text field 'myTxt' and this is an Optional field.
>
> However I have NumberValidator defined for this text field so that it should
> accept only numbers if data is entered.
>
> I follow these steps
>
> 1) enter text 'ABCD' in 'myTxt' field and submit the form
> 2) returns an error message - (Yes it should accept only numbers).
> 3) Delete all the text in myTxt field so that its empty and submit the form
> again.
> 4) returns the message 'This is a required field'.
>
> I am really puzzled by this error since the 'myTxt' field is an OPTIONAL one.
>
> Basically I want the Validator to validate this field only when some text is
> available otherwise it should just ignore it.
>
> Any help here would be appreciated.
>
> Thanks.
>
>Ken D. Nelson Guest



Reply With Quote

