-
6 Jul 2010 9:34 PM #1
Show valid icon if field is valid.
Show valid icon if field is valid.
Hii,
I try to show user name exist or not on create an account.
So I want to show validity icon on the right side of the textfield on both cases.
Can I do this with ExtJS validation tools or do I need to custom operation?
Thanks in advance.
-
17 Mar 2011 4:34 AM #2
Hi,
I know it's too late to response but hope that my information may help anyone after me.
- registers new xtype 'textfieldValidator' that will use x-form-valid-icon class for valid fields.Code:Ext.reg('textfieldValidator', Ext.extend(Ext.form.TextField, { listeners: {valid: function(el) { if(el.getValue().length>0) { imgid = Ext.get(el.id).next(); if (imgid) { imgid.addClass('x-form-valid-icon'); imgid.show(); }}},invalid:function(el){ imgid=Ext.get(el.id).next(); imgid.removeClass('x-form-valid-icon'); },render:function(el){el.markInvalid("Fake message");el.clearInvalid();}}, validator: function(e) {return true;} }));
Of course you need to create this class in your css - get example from x-form-invalid-icon records in css and create the same for x-form-valid-icon with changing picture location.
Not sure if there is more easy way to implement this behavior, but it worked for me.
-
20 Mar 2011 11:35 AM #3
Thanks for your reply.
I had resolved it in different way.
But your solution is better.
Thanks.
Similar Threads
-
Composite field do not fire 'valid' event correctly
By Traktopel in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 21 Jun 2010, 6:13 AM -
Composite field do not fire 'valid' event correctly
By Traktopel in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 21 Jun 2010, 4:21 AM -
Empty text for Field objects isn't valid?
By bburton in forum Ext GWT: DiscussionReplies: 4Last Post: 24 Nov 2009, 2:06 PM -
[CLOSED] Tooltip on RowEditor does not hide when field is not valid
By markmacumber in forum Ext GWT: Bugs (2.x)Replies: 1Last Post: 31 Aug 2009, 4:49 PM -
[Solved] Marking Valid Form Fields with Check Icon
By bzarzuela in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 22 Jul 2009, 5:16 PM


Reply With Quote