forked from extnet/Ext.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathField.cs
More file actions
2496 lines (2304 loc) · 89.6 KB
/
Field.cs
File metadata and controls
2496 lines (2304 loc) · 89.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/********
* @version : 2.1.1 - Ext.NET Pro License
* @author : Ext.NET, Inc. http://www.ext.net/
* @date : 2012-12-10
* @copyright : Copyright (c) 2007-2012, Ext.NET, Inc. (http://www.ext.net/). All rights reserved.
* @license : See license.txt and http://www.ext.net/license/.
********/
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using Ext.Net.Utilities;
using Newtonsoft.Json.Linq;
namespace Ext.Net
{
/// <summary>
/// Base class for form fields that provides default event handling, rendering, and other common functionality needed by all form field types. Utilizes the Ext.form.field.Field mixin for value handling and validation, and the Ext.form.Labelable mixin to provide label and error message display.
///
/// In most cases you will want to use a subclass, such as Ext.form.field.Text or Ext.form.field.Checkbox, rather than creating instances of this class directly. However if you are implementing a custom form field, using this as the parent class is recommended.
///
/// Values and Conversions
///
/// Because BaseField implements the Field mixin, it has a main value that can be initialized with the value config and manipulated via the getValue and setValue methods. This main value can be one of many data types appropriate to the current field, for instance a Date field would use a JavaScript Date object as its value type. However, because the field is rendered as a HTML input, this value data type can not always be directly used in the rendered field.
///
/// Therefore BaseField introduces the concept of a "raw value". This is the value of the rendered HTML input field, and is normally a String. The getRawValue and setRawValue methods can be used to directly work with the raw value, though it is recommended to use getValue and setValue in most cases.
///
/// Conversion back and forth between the main value and the raw value is handled by the valueToRaw and rawToValue methods. If you are implementing a subclass that uses a non-String value data type, you should override these methods to handle the conversion.
///
/// Rendering
///
/// The content of the field body is defined by the fieldSubTpl XTemplate, with its argument data created by the getSubTplData method. Override this template and/or method to create custom field renderings.
/// </summary>
[Meta]
[Description("Base Class for Form Fields that provides default event handling, sizing, value handling and other functionality.")]
public abstract partial class Field : ComponentBase, IAutoPostBack, IXPostBackDataHandler, IPostBackEventHandler, IToolbarItem, IField, IIcon, IAjaxPostBackEventHandler, INoneContentable
{
/// <summary>
///
/// </summary>
[Category("0. About")]
[Description("")]
public override string XType
{
get
{
return "field";
}
}
/// <summary>
///
/// </summary>
protected internal override bool ForceIdRendering
{
get
{
return !this.IsDynamic && this.Name.IsEmpty() && this.InputID.IsEmpty() && !this.IsMVC;
}
}
/// <summary>
///
/// </summary>
[Description("")]
protected virtual string UniqueName
{
get
{
if (this.IsProxy && this.Name.IsEmpty())
{
return this.InputID.IsEmpty() ? this.ID : this.InputID;
}
return this.Name.IsEmpty() ? (this.InputID.IsEmpty() ? this.ConfigID : this.InputID) : this.Name;
}
}
/// <summary>
/// TextBox_AutoPostBack
/// </summary>
[Meta]
[Category("5. Field")]
[DefaultValue(false)]
[Description("TextBox_AutoPostBack")]
public virtual bool AutoPostBack
{
get
{
return this.State.Get<bool>("AutoPostBack", false);
}
set
{
this.State.Set("AutoPostBack", value);
}
}
/// <summary>
///
/// </summary>
[Meta]
[DefaultValue("change")]
[Description("")]
public virtual string PostBackEvent
{
get
{
return this.State.Get<string>("PostBackEvent", "change");
}
set
{
this.State.Set("PostBackEvent", value);
}
}
/// <summary>
/// Gets or sets a value indicating whether validation is performed when the control is set to validate when a postback occurs.
/// </summary>
[Meta]
[Category("5. Field")]
[DefaultValue(false)]
[Description("Gets or sets a value indicating whether validation is performed when the control is set to validate when a postback occurs.")]
public virtual bool CausesValidation
{
get
{
return this.State.Get<bool>("CausesValidation", false);
}
set
{
this.State.Set("CausesValidation", value);
}
}
/// <summary>
/// Gets or Sets the Controls ValidationGroup
/// </summary>
[Meta]
[Category("5. Field")]
[DefaultValue("")]
[Description("Gets or Sets the Controls ValidationGroup")]
public virtual string ValidationGroup
{
get
{
return this.State.Get<string>("ValidationGroup", "");
}
set
{
this.State.Set("ValidationGroup", value);
}
}
/* Public Properties
-----------------------------------------------------------------------------------------------*/
/// <summary>
/// If specified, then the component will be displayed with this value as its active error when first rendered. Defaults to undefined. Use setActiveError or unsetActiveError to change it after component creation.
/// </summary>
[Meta]
[ConfigOption]
[DirectEventUpdate(MethodName = "SetActiveError")]
[Category("5. Field")]
[DefaultValue(null)]
[Description("If specified, then the component will be displayed with this value as its active error when first rendered. Defaults to undefined. Use setActiveError or unsetActiveError to change it after component creation.")]
public virtual string ActiveError
{
get
{
return this.State.Get<string>("ActiveError", null);
}
set
{
this.State.Set("ActiveError", value);
}
}
private XTemplate activeErrorsTpl;
/// <summary>
/// The template used to format the Array of error messages passed to setActiveErrors into a single HTML string. By default this renders each message as an item in an unordered list.
///
/// Standard template:
/// <code>
/// '<tpl if="errors && errors.length">',
/// '<ul><tpl for="errors"><li<tpl if="xindex == xcount"> class="last"</tpl>>{.}</li></tpl></ul>',
/// '</tpl>'
/// </code>
/// </summary>
[Meta]
[DefaultValue(null)]
[Category("5. Field")]
[ConfigOption("activeErrorsTpl", typeof(LazyControlJsonConverter))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Description("The template used to format the Array of error messages passed to setActiveErrors into a single HTML string. By default this renders each message as an item in an unordered list.")]
public virtual XTemplate ActiveErrorsTpl
{
get
{
return this.activeErrorsTpl;
}
set
{
if (this.activeErrorsTpl != null)
{
this.Controls.Remove(this.activeErrorsTpl);
this.LazyItems.Remove(this.activeErrorsTpl);
}
this.activeErrorsTpl = value;
if (this.activeErrorsTpl != null)
{
this.activeErrorsTpl.EnableViewState = false;
this.Controls.Add(this.activeErrorsTpl);
this.LazyItems.Add(this.activeErrorsTpl);
}
}
}
/// <summary>
/// Whether to adjust the component's body area to make room for 'side' or 'under' error messages. Defaults to true.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(true)]
[Description("Whether to adjust the component's body area to make room for 'side' or 'under' error messages. Defaults to true.")]
public virtual bool AutoFitErrors
{
get
{
return this.State.Get<bool>("AutoFitErrors", true);
}
set
{
this.State.Set("AutoFitErrors", value);
}
}
/// <summary>
/// The CSS class to be applied to the body content element. Defaults to 'x-form-item-body'.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-item-body")]
[Description("The CSS class to be applied to the body content element. Defaults to 'x-form-item-body'.")]
public virtual string BaseBodyCls
{
get
{
return this.State.Get<string>("BaseBodyCls", "x-form-item-body");
}
set
{
this.State.Set("BaseBodyCls", value);
}
}
/// <summary>
/// Defines a timeout in milliseconds for buffering checkChangeEvents that fire in rapid succession. Defaults to 50 milliseconds.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(50)]
[Description("Defines a timeout in milliseconds for buffering checkChangeEvents that fire in rapid succession. Defaults to 50 milliseconds.")]
public virtual int CheckChangeBuffer
{
get
{
return this.State.Get<int>("CheckChangeBuffer", 50);
}
set
{
this.State.Set("CheckChangeBuffer", value);
}
}
/// <summary>
/// A list of event names that will be listened for on the field's input element, which will cause the field's value to be checked for changes. If a change is detected, the change event will be fired, followed by validation if the validateOnChange option is enabled.
///
/// Defaults to ['change', 'propertychange'] in Internet Explorer, and ['change', 'input', 'textInput', 'keyup', 'dragdrop'] in other browsers. This catches all the ways that field values can be changed in most supported browsers; the only known exceptions at the time of writing are:
///
/// Safari 3.2 and older: cut/paste in textareas via the context menu, and dragging text into textareas
/// Opera 10 and 11: dragging text into text fields and textareas, and cut via the context menu in text fields and textareas
/// Opera 9: Same as Opera 10 and 11, plus paste from context menu in text fields and textareas
/// If you need to guarantee on-the-fly change notifications including these edge cases, you can call the checkChange method on a repeating interval, e.g. using Ext.TaskManager, or if the field is within a Ext.form.Panel, you can use the FormPanel's Ext.form.Panel.pollForChanges configuration to set up such a task automatically.
/// </summary>
[Meta]
[ConfigOption(typeof(StringArrayJsonConverter))]
[TypeConverter(typeof(StringArrayConverter))]
[Category("5. Field")]
[DefaultValue(null)]
[Description("A list of event names that will be listened for on the field's input element, which will cause the field's value to be checked for changes. If a change is detected, the change event will be fired, followed by validation if the validateOnChange option is enabled.")]
public virtual string[] CheckChangeEvents
{
get
{
return this.State.Get<string[]>("CheckChangeEvents", null);
}
set
{
this.State.Set("CheckChangeEvents", value);
}
}
/// <summary>
/// The CSS class used to to apply to the special clearing div rendered directly after each form field wrapper to provide field clearing (defaults to 'x-clear').
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-clear")]
[Description("The CSS class used to to apply to the special clearing div rendered directly after each form field wrapper to provide field clearing (defaults to 'x-clear').")]
public virtual string ClearCls
{
get
{
return this.State.Get<string>("ClearCls", "x-clear");
}
set
{
this.State.Set("ClearCls", value);
}
}
/// <summary>
/// The CSS class to use when the field value is dirty.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-dirty")]
[Description("The CSS class to use when the field value is dirty.")]
public virtual string DirtyCls
{
get
{
return this.State.Get<string>("DirtyCls", "x-form-dirty");
}
set
{
this.State.Set("DirtyCls", value);
}
}
/// <summary>
/// The CSS class to be applied to the error message element. Defaults to 'x-form-error-msg'.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-error-msg")]
[Description("The CSS class to be applied to the error message element. Defaults to 'x-form-error-msg'.")]
public virtual string ErrorMsgCls
{
get
{
return this.State.Get<string>("ErrorMsgCls", "x-form-error-msg");
}
set
{
this.State.Set("ErrorMsgCls", value);
}
}
/// <summary>
/// An extra CSS class to be applied to the body content element in addition to baseBodyCls. Defaults to empty.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Description("An extra CSS class to be applied to the body content element in addition to baseBodyCls. Defaults to empty.")]
public virtual string FieldBodyCls
{
get
{
return this.State.Get<string>("FieldBodyCls", "");
}
set
{
this.State.Set("FieldBodyCls", value);
}
}
/// <summary>
/// The default CSS class for the field input (defaults to 'x-form-field').
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Description("The default CSS class for the field input (defaults to 'x-form-field').")]
public virtual string FieldCls
{
get
{
return this.State.Get<string>("FieldCls", "");
}
set
{
this.State.Set("FieldCls", value);
}
}
/// <summary>
/// The label for the field. It gets appended with the labelSeparator, and its position and sizing is determined by the labelAlign, labelWidth, and labelPad configs. Defaults to undefined.
/// </summary>
[Meta]
[ConfigOption]
[DirectEventUpdate(MethodName = "SetFieldLabel")]
[Category("5. Field")]
[DefaultValue("")]
[Localizable(true)]
[Description("The label for the field. It gets appended with the labelSeparator, and its position and sizing is determined by the labelAlign, labelWidth, and labelPad configs. Defaults to undefined.")]
public virtual string FieldLabel
{
get
{
return this.State.Get<string>("FieldLabel", "");
}
set
{
this.State.Set("FieldLabel", value);
}
}
/// <summary>
/// Optional CSS style(s) to be applied to the field input element. Should be a valid argument to Ext.Element.applyStyles. Defaults to undefined. See also the setFieldStyle method for changing the style after initialization.
/// </summary>
[Meta]
[ConfigOption]
[DirectEventUpdate(MethodName = "SetFieldStyle")]
[Category("5. Field")]
[DefaultValue("")]
[Localizable(true)]
[Description("Optional CSS style(s) to be applied to the field input element. Should be a valid argument to Ext.Element.applyStyles. Defaults to undefined. See also the setFieldStyle method for changing the style after initialization.")]
public virtual string FieldStyle
{
get
{
return this.State.Get<string>("FieldStyle", "");
}
set
{
this.State.Set("FieldStyle", value);
}
}
private XTemplate fieldSubTpl;
/// <summary>
/// The content of the field body is defined by this config option.
/// </summary>
[Meta]
[DefaultValue(null)]
[Category("5. Field")]
[ConfigOption("fieldSubTpl", typeof(LazyControlJsonConverter))]
[PersistenceMode(PersistenceMode.InnerProperty)]
[Description("The content of the field body is defined by this config option.")]
public virtual XTemplate FieldSubTpl
{
get
{
return this.fieldSubTpl;
}
set
{
if (this.fieldSubTpl != null)
{
this.Controls.Remove(this.fieldSubTpl);
this.LazyItems.Remove(this.fieldSubTpl);
}
this.fieldSubTpl = value;
if (this.fieldSubTpl != null)
{
this.fieldSubTpl.EnableViewState = false;
this.Controls.Add(this.fieldSubTpl);
this.LazyItems.Add(this.fieldSubTpl);
}
}
}
/// <summary>
/// The CSS class to use when the field receives focus (defaults to 'x-form-focus')
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-focus")]
[Description("The CSS class to use when the field receives focus (defaults to 'x-form-focus')")]
public virtual string FocusCls
{
get
{
return this.State.Get<string>("FocusCls", "x-form-focus");
}
set
{
this.State.Set("FocusCls", value);
}
}
/// <summary>
/// A CSS class to be applied to the outermost element to denote that it is participating in the form field layout. Defaults to 'x-form-item'.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-item")]
[Description("A CSS class to be applied to the outermost element to denote that it is participating in the form field layout. Defaults to 'x-form-item'.")]
public virtual string FormItemCls
{
get
{
return this.State.Get<string>("FormItemCls", "x-form-item");
}
set
{
this.State.Set("FormItemCls", value);
}
}
/// <summary>
/// When set to true, the label element (fieldLabel and labelSeparator) will be automatically hidden if the fieldLabel is empty. Setting this to false will cause the empty label element to be rendered and space to be reserved for it; this is useful if you want a field without a label to line up with other labeled fields in the same form. Defaults to true.
///
/// If you wish to unconditionall hide the label even if a non-empty fieldLabel is configured, then set the hideLabel config to true.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(true)]
[Description(" When set to true, the label element (fieldLabel and labelSeparator) will be automatically hidden if the fieldLabel is empty.")]
public virtual bool HideEmptyLabel
{
get
{
return this.State.Get<bool>("HideEmptyLabel", true);
}
set
{
this.State.Set("HideEmptyLabel", value);
}
}
/// <summary>
/// Set to true to completely hide the label element (fieldLabel and labelSeparator). Defaults to false.
///
/// Also see hideEmptyLabel, which controls whether space will be reserved for an empty fieldLabel.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(false)]
[Description("Set to true to completely hide the label element (fieldLabel and labelSeparator). Defaults to false.")]
public virtual bool HideLabel
{
get
{
return this.State.Get<bool>("HideLabel", false);
}
set
{
this.State.Set("HideLabel", value);
}
}
/// <summary>
/// The id that will be given to the generated input DOM element. Defaults to an automatically generated id. If you configure this manually, you must make sure it is unique in the document.
/// </summary>
[Meta]
[ConfigOption("inputId")]
[Category("5. Field")]
[DefaultValue("")]
[Description("The id that will be given to the generated input DOM element. Defaults to an automatically generated id. If you configure this manually, you must make sure it is unique in the document.")]
public virtual string InputID
{
get
{
return this.State.Get<string>("InputID", "");
}
set
{
this.State.Set("InputID", value);
}
}
/// <summary>
/// The type attribute for input fields -- e.g. radio, text, password, file. The extended types supported by HTML5 inputs (url, email, etc.) may also be used, though using them will cause older browsers to fall back to 'text'.
/// The type 'password' must be used to render that field type currently -- there is no separate Ext component for that. You can use Ext.form.field.File which creates a custom-rendered file upload field, but if you want a plain unstyled file input you can use a Base with inputType:'file'.
/// Defaults to: "text"
/// </summary>
[Meta]
[ConfigOption(JsonMode.ToLower)]
[Category("5. Field")]
[DefaultValue(InputType.Text)]
[Description("The type attribute for input fields.")]
public virtual InputType InputType
{
get
{
return this.State.Get<InputType>("InputType", InputType.Text);
}
set
{
this.State.Set("InputType", value);
}
}
/// <summary>
/// The width of the field input element in pixels. Defaults to 100.
/// </summary>
[Meta]
[ConfigOption]
[DefaultValue(100)]
[NotifyParentProperty(true)]
[Description("The width of the field input element in pixels. Defaults to 100.")]
public virtual int InputWidth
{
get
{
return this.State.Get<int>("InputWidth", 100);
}
set
{
this.State.Set("InputWidth", value);
}
}
/// <summary>
/// The CSS class to use when marking the component invalid (defaults to 'x-form-invalid')
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("x-form-invalid")]
[Description("The CSS class to use when marking the component invalid (defaults to 'x-form-invalid')")]
public virtual string InvalidCls
{
get
{
return this.State.Get<string>("InvalidCls", "x-form-invalid");
}
set
{
this.State.Set("InvalidCls", value);
}
}
/// <summary>
/// The error text to use when marking a field invalid and no message is provided (defaults to 'The value in this field is invalid')
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Localizable(true)]
[Description("The error text to use when marking a field invalid and no message is provided (defaults to 'The value in this field is invalid').")]
public virtual string InvalidText
{
get
{
return this.State.Get<string>("InvalidText", "");
}
set
{
this.State.Set("InvalidText", value);
}
}
/// <summary>
/// Controls the position and alignment of the fieldLabel. Valid values are:
/// "left" (the default) - The label is positioned to the left of the field, with its text aligned to the left. Its width is determined by the labelWidth config.
/// "top" - The label is positioned above the field.
/// "right" - The label is positioned to the left of the field, with its text aligned to the right. Its width is determined by the labelWidth config.
/// </summary>
[Meta]
[ConfigOption(JsonMode.ToLower)]
[Category("5. Field")]
[DefaultValue(LabelAlign.Left)]
[NotifyParentProperty(true)]
[Description("Controls the position and alignment of the fieldLabel.")]
public virtual LabelAlign LabelAlign
{
get
{
return this.State.Get<LabelAlign>("LabelAlign", LabelAlign.Left);
}
set
{
this.State.Set("LabelAlign", value);
}
}
/// <summary>
/// The CSS class to be applied to the label element. Defaults to 'x-form-item-label'. This (single) CSS class is used to formulate the renderSelector and drives the field layout where it is concatenated with a hyphen ('-') and labelAlign. To add additional classes, use labelClsExtra.
/// </summary>
[Meta]
[ConfigOption("labelClsExtra")]
[Category("5. Field")]
[DefaultValue("")]
[Description("The CSS class to be applied to the label element.")]
public virtual string LabelCls
{
get
{
return this.State.Get<string>("LabelCls", "");
}
set
{
this.State.Set("LabelCls", value);
}
}
/// <summary>
/// The amount of space in pixels between the fieldLabel and the input field. Defaults to 5.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(5)]
[NotifyParentProperty(true)]
[Description("The amount of space in pixels between the fieldLabel and the input field. Defaults to 5.")]
public virtual int LabelPad
{
get
{
return this.State.Get<int>("LabelPad", 5);
}
set
{
this.State.Set("LabelPad", value);
}
}
/// <summary>
/// Character(s) to be inserted at the end of the label text.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(":")]
[Description("Character(s) to be inserted at the end of the label text.")]
public virtual string LabelSeparator
{
get
{
return this.State.Get<string>("LabelSeparator", ":");
}
set
{
this.State.Set("LabelSeparator", value);
}
}
/// <summary>
/// A CSS style specification string to apply directly to this field's label. Defaults to undefined.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Description("A CSS style specification string to apply directly to this field's label. Defaults to undefined.")]
public virtual string LabelStyle
{
get
{
return this.State.Get<string>("LabelStyle", "");
}
set
{
this.State.Set("LabelStyle", value);
}
}
/// <summary>
/// The width of the fieldLabel in pixels. Only applicable if the labelAlign is set to "left" or "right". Defaults to 100.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(100)]
[NotifyParentProperty(true)]
[Description("The width of the fieldLabel in pixels. Only applicable if the labelAlign is set to \"left\" or \"right\". Defaults to 100.")]
public virtual int LabelWidth
{
get
{
return this.State.Get<int>("LabelWidth", 100);
}
set
{
this.State.Set("LabelWidth", value);
}
}
/// <summary>
/// The location where the error message text should display. Must be one of the following values:
///
/// qtip Display a quick tip containing the message when the user hovers over the field. This is the default.
/// title Display the message in a default browser title attribute popup.
/// under Add a block div beneath the field containing the error message.
/// side Add an error icon to the right of the field, displaying the message in a popup on hover.
/// none Don't display any error message. This might be useful if you are implementing custom error display.
/// [element id] Add the error message directly to the innerHTML of the specified element.
/// </summary>
[Meta]
[ConfigOption(JsonMode.ToLower)]
[Category("5. Field")]
[TypeConverter(typeof(MessageTarget))]
[DefaultValue(MessageTarget.Qtip)]
[Description("The location where the error message text should display.")]
public virtual MessageTarget MsgTarget
{
get
{
return this.State.Get<MessageTarget>("MsgTarget", MessageTarget.Qtip);
}
set
{
this.State.Set("MsgTarget", value);
}
}
/// <summary>
/// Add the error message directly to the innerHTML of the specified element.
/// </summary>
[Meta]
[ConfigOption("msgTarget")]
[Category("5. Field")]
[DefaultValue("")]
[Description("Add the error message directly to the innerHTML of the specified element.")]
public virtual string MsgTargetElement
{
get
{
return this.State.Get<string>("MsgTargetElement", "");
}
set
{
this.State.Set("MsgTargetElement", value);
}
}
/// <summary>
/// The name of the field (defaults to undefined). This is used as the parameter name when including the field value in a form submit(). If no name is configured, it falls back to the inputId. To prevent the field from being included in the form submit, set submitValue to false.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Description("The field's HTML name attribute (defaults to ''). Note: this property must be set if this field is to be automatically included with form submit().")]
public virtual string Name
{
get
{
return this.State.Get<string>("Name", "");
}
set
{
this.State.Set("Name", value);
}
}
/// <summary>
/// true to disable displaying any error message set on this object. Defaults to false.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(false)]
[Description("true to disable displaying any error message set on this object. Defaults to false.")]
public virtual bool PreventMark
{
get
{
return this.State.Get<bool>("PreventMark", false);
}
set
{
this.State.Set("PreventMark", value);
}
}
/// <summary>
/// true to mark the field as readOnly in HTML (defaults to false).
/// Note: this only sets the element's readOnly DOM attribute.
/// Setting readOnly=true, for example, will not disable triggering a ComboBox or Date; it gives you the option of forcing the user to choose via the trigger without typing in the text box. To hide the trigger use hideTrigger.
/// </summary>
[Meta]
[DirectEventUpdate(MethodName = "SetReadOnly")]
[ConfigOption]
[Category("5. Field")]
[Bindable(true)]
[DefaultValue(false)]
[Description("true to mark the field as readOnly in HTML (defaults to false).")]
public virtual bool ReadOnly
{
get
{
return this.State.Get<bool>("ReadOnly", false);
}
set
{
this.State.Set("ReadOnly", value);
}
}
/// <summary>
/// The CSS class applied to the component's main element when it is readOnly.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue("")]
[Description("The CSS class applied to the component's main element when it is readOnly.")]
public virtual string ReadOnlyCls
{
get
{
return this.State.Get<string>("ReadOnlyCls", "");
}
set
{
this.State.Set("ReadOnlyCls", value);
}
}
/// <summary>
/// Setting this to false will prevent the field from being submitted even when it is not disabled. Defaults to true.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(true)]
[Description("Setting this to false will prevent the field from being submitted even when it is not disabled. Defaults to true.")]
public virtual bool SubmitValue
{
get
{
return this.State.Get<bool>("SubmitValue", true);
}
set
{
this.State.Set("SubmitValue", value);
}
}
/// NOTE: [2009-11-30] [geoff] Might be a conflict with @TabIndex property and short type. Can not change/override member type.
/// <summary>
/// The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue((short)0)]
[Description("The tabIndex for this field. Note this only applies to fields that are rendered, not those which are built via applyTo (defaults to undefined).")]
public override short TabIndex
{
get
{
return this.State.Get<short>("TabIndex", (short)0);
}
set
{
this.State.Set("TabIndex", value);
}
}
/// <summary>
/// Whether the field should validate when it loses focus (defaults to true). This will cause fields to be validated as the user steps through the fields in the form regardless of whether they are making changes to those fields along the way. See also validateOnChange.
/// </summary>
[Meta]
[ConfigOption]
[Category("5. Field")]
[DefaultValue(true)]
[Description("Whether the field should validate when it loses focus (defaults to true). This will cause fields to be validated as the user steps through the fields in the form regardless of whether they are making changes to those fields along the way. See also validateOnChange.")]
public virtual bool ValidateOnBlur
{
get
{
return this.State.Get<bool>("ValidateOnBlur", true);
}
set
{
this.State.Set("ValidateOnBlur", value);
}
}
/// <summary>
/// Specifies whether this field should be validated immediately whenever a change in its value is detected. Defaults to true. If the validation results in a change in the field's validity, a validitychange event will be fired. This allows the field to show feedback about the validity of its contents immediately as the user is typing.