[CLOSED] Trying to flag a form as invalid

  1. #1

    [CLOSED] Trying to flag a form as invalid

    Hello,

    In my client script I'm trying to mark the containing form of a field invalid with Javascript similar to the following:

    var showResultText = function (btn, text) {
    
        var myUserName, msg, myUserNameField, myParent, invalidUserIdMsg, formId;
    
        if (btn === "ok") {
            //Do something else
        } else {
            invalidUserIdMsg = "invalid user";
            myUserNameField = eval("ContentPH_txtUserName");
            myUserNameField.markInvalid(invalidUserIdMsg);
            formId = _frmMain.id;
            _frmMain.getForm().markInvalid({ formId : invalidUserIdMsg});
        }
    }
    So the txtUserName gets set as invalid, and that works as expected. I'm not having any luck setting the form as invalid. If I do a _frmMain.getForm().isValid() right after the markInvalid, it says "true."

    Any idea what I'm doing wrong?

    Thanks
    Last edited by Daniil; Jun 13, 2011 at 4:00 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please read the doc article about .markInvalid().
    http://dev.sencha.com/deploy/ext-3.3...er=markInvalid

    Now you should know that .markInvalid() just marks a field as invalid, not makes it really invalid.

    To make a field invalid you can use .validator.
    field.validator = function () { return false; }
    The call .isValid().

    To make it valid:
    field.validator = null;

Similar Threads

  1. Replies: 4
    Last Post: Apr 30, 2012, 4:49 PM
  2. [CLOSED] cross-window form validation with focus on an invalid control
    By ViniVidi in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 18, 2011, 4:51 PM
  3. [CLOSED] German Flag
    By csharpdev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 11, 2011, 1:20 PM
  4. Replies: 2
    Last Post: Feb 12, 2010, 5:03 AM
  5. Flag images is not fit for menu item
    By Tom Zhang in forum 1.x Help
    Replies: 0
    Last Post: Jun 23, 2009, 2:07 PM

Posting Permissions