Main Region

Change Ext JS Property at Runtime
1 answer | 685 views

VI
Nov 20, 2014 19:06 +00:00

Hi !!

I got a case where I have a Form field that must be mandatory (or not) depending on a value of another Form field. I would like to make the validation at runtime, just like the vtype does.(not when I post the page) I cannot use the VType because it is not triggered when the value is null. There is an Ext JS property that indicates if the field is required (allowBlank) which work fine, but I cannot change it at runtime..

Is there something I can do to achieve this kind of validation?

Thanks!!

1 comment

VI
Vince Nov 20, 2014 19:32 +00:00 

Thanks Matt! You're wonderful! ;)

MN
Nov 20, 2014 19:27 +00:00

You can change these attributes at runtime, whilst we don't officially support you writing your own custom javascript you could do the following:

var item = Ext.getCmp('P1_ITEM');
if (item) {
   Ext.apply(item, {allowBlank: true, vtype: 'myCustomValidation'});
}
0 comments

You must log in or sign up to post questions and answers.