I created two DropDown items (GenericChooser), and want to make both
of them required..so I tried to use the Formatter (as can be found in
some of the examples - formatter="$formatters.requiredString") but
there wasn't any error reported...so I wrote my own method to check if
something is set...but how can I display my error? haven't found any
example yet, could you please provide some
thanks in advance
cheers, baer
Usually, the formatter is used for both string->object conversion and
object->string conversion.
In this case, the formatter is only used for the latter.
You can check and display error in your action like this:
public AWComponent submitAction ()
{
valid = <custom validation>
if (!valid) {
recordValidationError("myErrorKey", "myErrorMessage",
errorValue);
}
if (errorManager().checkErrorsAndEnableDisplay()) return null;
<proceed to next page>
}
The error banner should show up on the top of the page.
The errorKey comes into play if you are using FormTable/FormRow:
<w:FormTable>
<w:FormRow label="Field1" required="$true" errorKey="myErrorKey">
<w:GenericChooser/>
</w:FormRow>
<w:FormRow label="Field2" required="$true" errorKey="myErrorKey2">
...
</w:FormTable>
This will cause the error and a red asterisk to show up next to field
with the same errorKey.
Thanks,
Kingsley