Form validation error!

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139