Need help with validators on Ext::FormFields like Ext::LineEdit

Added by Dataconomy Inc over 1 year ago

Hello @All,

I am using some Ext::LineEdit's on a Ext::Panel. Everything works fine (Well, there were some probleme with layouting them, but after implementation a new class inherited from Ext::Panel which now reacts to layoutSizeChanged, now all works fine).

On a special event there should start an action according to the data entered into the Ext::LineEdit's. But before that action, they should be validated. Validating (and therefore deciding whether to start the action) works fine, but if the validating fails (aborting the start of the action) I want to show the user all fields, which did not validate. Using WLineEdit the state of the validation is always shown correctly, but using Ext::LineEdit the state is only shown if the control got the focus.

I did not find any way to get the fields show their validation status without using the setFocus. Well, theoretically I would temporary accept the way using setFocus, but enumerating all fields with a setFocus always fires the appropriate blurred Events.

Which is the best way to let Ext::LineEdit controls show their validation status?

Regards,

Andreas.


Replies

RE: Need help with validators on Ext::FormFields like Ext::LineEdit - Added by Dataconomy Inc over 1 year ago

I still need help on this topic.

Let's say, I have the following situation:

void myClass::someInitFunction() {
    // These vars are protected class members
    m_pExtLineEdit1 = new Ext::LineEdit;
    m_pExtLineEdit2 = new Ext::LineEdit;
    m_pExtLineEdit3 = new Ext::LineEdit;

    // Do some things
}

void myApp::gotButtonClick() {
    if (m_pExtLineEdit1->validate() != WValidator::Valid) return;
    if (m_pExtLineEdit2->validate() != WValidator::Valid) return;
    if (m_pExtLineEdit3->validate() != WValidator::Valid) return;

    // Do some things
}

I want to get the m_pExtLineEdit Widgets to get red, if they fail their validation. The only way I currently know is settings the focus on them. But that would mean to set the focus on all m_pExtLineEdit Widgets in this example, if they all fail validation. And settings the focus always fire other events.