Raja
Raja

Reputation: 9

Flex 4 datefield No Error Rectangle with Date Validator

I am using DateField and validating date with a date validator. Its working fine but when invalid date is there a usual red rectangle is not being shown around datefield but if mouse hovered over date field a error tooltip is shown.

What shall I do to show a error rectangle around invalid dateField.

the ref code is

    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <validators:CodeValidator id="seriesVal" minLength="3" maxLength="3" required="true" source="{edSeries}" property="text" triggerEvent=""/>
    <mx:StringValidator id="remarksVal" required="true" source="{edRemarks}" property="text" triggerEvent=""/>
    <s:NumberValidator id="fromVal" minValue="0" maxValue="99999999" domain="int" required="true" source="{edFrom}" property="text" triggerEvent=""/>
    <s:NumberValidator id="toVal" minValue="0" maxValue="99999999" domain="int" required="true" source="{edTo}" property="text" triggerEvent=""/>
    **<mx:DateValidator id="txnDateVal" required="true" source="{edTXNDate}" property="text" triggerEvent=""/>**
</fx:Declarations>

.....

in init function

validatorArr = new Array();
validatorArr.push(txnDateVal);
validatorArr.push(seriesVal);
validatorArr.push(fromVal);
validatorArr.push(toVal);
validatorArr.push(remarksVal);

in OKbutton click

// First Validate Data if invalid data then continuw editing
if (Validator.validateAll(validatorArr).length > 0){
setFormFocus();
return;
}



<s:Label x="262" y="47.420326" styleName="FormLabel" text="Date"/>
<mx:DateField id="edTXNDate" x="337" y="40.570312" width="137" height="22" editable="true"
              formatString="DD/MM/YYYY" toolTip="Transaction date" yearNavigationEnabled="true"
              selectableRange = "{{rangeEnd : new Date()}}" />

Upvotes: 0

Views: 1170

Answers (1)

Tianzhen Lin
Tianzhen Lin

Reputation: 2614

I pasted your code in an empty application and could not reproduce the problem. Which led me to suspect a few things

  1. Try to disable any CSS in your application, and see if any CSS setting might have prevented the red halo around your app.
  2. Remove all validators except the date validator and see if the issue persists.

Good luck.

Upvotes: 0

Related Questions