-
2 Dec 2010 2:31 AM #1
NumberField Custom validation
NumberField Custom validation
Hi,
I want to write a custom validator for NumberField by extending NumberFiled class.
My Requirement is I have to display in the numberfield as "(Multiple)" string even though it does not allow to insert string from JSON response object.
please can you help me in how to write a custom validation for NumberField to display string using extjs code whenevrer my numberfield containg the value as "(Multiple)" from JSON response object .
Regards
Kishore
-
4 Dec 2010 12:31 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
I would use TextField as basis and not NumberField (otherwise you also need to revert the maskRe).
Next, you need to override the validateValue and add your own validation.
-
10 Dec 2010 9:29 AM #3
I am a newbie in GWT/GXT world. I am trying to use a NumberField but I am getting ClassCastException.
BTW, I am binding the fields with a JSON object.
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
at com.extjs.gxt.ui.client.widget.form.NumberPropertyEditor.getStringValue(NumberPropertyEditor.java:1)
at com.extjs.gxt.ui.client.widget.form.Field.setValue(Field.java:955)
at com.extjs.gxt.ui.client.widget.form.TextField.setValue(TextField.java:415)
at com.extjs.gxt.ui.client.binding.FieldBinding.updateField(FieldBinding.java:207)
at com.extjs.gxt.ui.client.binding.FieldBinding.bind(FieldBinding.java:82)
-
10 Dec 2010 12:29 PM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Please ask GXT questions in the GXT forum.
Similar Threads
-
NumberField in EditorGridPanel maxValue validation
By irinarosu in forum Ext 3.x: Help & DiscussionReplies: 12Last Post: 18 Nov 2012, 1:42 AM -
NumberField validation does not fire after override of afterRender
By apachejo in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 19 Aug 2012, 11:50 PM -
[Firefox 2 / GXT 2.1.3] Numberfield validation
By sdumas in forum Ext GWT: DiscussionReplies: 4Last Post: 16 Jun 2010, 8:54 AM -
NumberField validation
By alt_004 in forum Ext GWT: DiscussionReplies: 0Last Post: 1 Jun 2009, 3:21 AM -
Validation of floating number in numberfield.
By kckc1234 in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 17 Jan 2009, 3:15 AM


Reply With Quote