View Full Version : Trying to flag a form as invalid

9 Jun 2011, 10:40 AM

I'm using Ext.Net, but I have a question that I think pertains more to straight Ext.js. 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");
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?


10 Jun 2011, 6:15 AM
See the code:


BasicForm.markInvalid() can be used to mark fields as invalid but not the form itself.