Skip to content

Control Validations using Invalid and InvalidMessage properties #865

Closed

Description

@itg-assistant

Matthew Ferry asked 2017-05-27 00:09:04 UTC

Hi - I'd like to use the .Invalid property and the .InvalidMessage properties to perform passive UI validations, but I do not see how they work, other than just as properties.  Do I need to provide my own error message display mechanism to display the message if I am not using the error provider?

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-05-27 15:34:28 UTC

    Hi Matthew,

    I just tried with two textbox controls on a page, set their InvalidMessage property in the designer to an error message, then in a button click handler I set their Invalid property to true. The result is the textbox controls with a red border and when you place the cursor over the controls you see the error tooltip with the message.

    Basically, when you set Invalid = true, Wisej applies the "invalid" state which is styled in the theme. You can decide how to decorate invalid controls. The InvalidMessage is set to the invalid tooltip. The invalid tooltip can also be themed. See the Controls page in the ThemeBuilder.

    When you handle the Validating event and set e.Cancel = true, Wisej sets the Invalid property to true, with the same result as if you did it in your code.

    The error provider is different, it adds an icon next to the invalid controls.

    HTH

    Best,

    Luca

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Matthew Ferry answered 2017-05-27 19:02:47 UTC

    Thanks so much Luca.  I am able to produce results using the method you say.  But I was trying to dynamically set both properties in the text box validating event.  And that doesn't seem to work as I would (perhaps mistakenly) expect - perhaps due to sequencing of events.  However it does work the way I was seeking in the LostFocus event.  So that works for my needs.

    Thanks very much!

  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-05-27 20:29:52 UTC

    Got it. If you set Invalid=true in the Validating event Wisej probably sets it back to false since it expects e.Cancel to be set to true to indicate that the control is not validated. Try the Validated event instead. I can see if we can detect the change to the property and preserve it instead of relying only on the Cancel property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions