PDA

View Full Version : Trying to flag a form as invalid



ewgoforth
9 Jun 2011, 10:40 AM
Hello,

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");
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

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

http://dev.sencha.com/deploy/ext-3.4.0/docs/source/BasicForm.html#method-Ext.form.BasicForm-markInvalid

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