forked from rheimbuch/inputex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguide.html
870 lines (642 loc) · 28.4 KB
/
guide.html
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>inputEx - Guide</title>
<link rel="alternate" type="application/rss+xml" title="neyric’s Javascript RSS Feed" href="http://javascript.neyric.com/blog/feed/" />
<link rel="pingback" href="http://javascript.neyric.com/blog/xmlrpc.php" />
<link href="res/style.css" media="screen" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="res/guide.css" />
<link rel="stylesheet" type="text/css" href="res/SyntaxHighlighter/shCore.css" />
<link type="text/css" rel="stylesheet" href="res/SyntaxHighlighter/shThemeDefault.css" id="shTheme"/>
<script type="text/javascript" src="res/SyntaxHighlighter/shCore.js"></script>
<script type="text/javascript" src="res/SyntaxHighlighter/shBrushJScript.js"></script>
<script type="text/javascript" src="res/SyntaxHighlighter/shBrushXml.js"></script>
<script type="text/javascript" src="res/SyntaxHighlighter/shBrushCss.js"></script>
<script type="text/javascript">SyntaxHighlighter.config.clipboardSwf = 'res/SyntaxHighlighter/clipboard.swf';SyntaxHighlighter.all();</script>
</head>
<body>
<div id='headbar'>
<ul class="navigation" style=" position: absolute; margin: 6px 0 0 380px;">
<li><a href="./">Home</a></li>
<li><a href="http://github.com/neyric/inputex/">GitHub[Git]</a></li>
<li><a href="http://github.com/neyric/inputex/issues">Issues</a></li>
<li><a href="api/index.html">API Documentation</a></li>
<li><a href="guide.html">Guide</a></li>
<li><a href="http://neyric.com/category/inputex/">Blog</a>
<a href="http://neyric.com/feed/"><img src="res/rss.png" alt="rss icon"/></a></li>
<li><a href="http://groups.google.com/group/inputex/">Forums</a></li>
</ul>
<div style="position: absolute; top: 50px; left: 850px; font-size: 90%; line-height: 30px;">
<img src='http://www.twitter.com/favicon.ico' /> follow <a href="http://twitter.com/inputex">inputEx on Twitter</a><br />
<img src="http://delicious.com/favicon.ico"> bookmark on <a href="http://delicious.com/url/3ec78b218716387ceb93dda7b5d0f84d">Del.icio.us</a><br />
<img src='http://github.com/favicon.ico'/> follow <a href="http://github.com/neyric/inputex/tree/master"> on GitHub</a>
</div>
</div>
<div align="center">
<div style="text-align: left; width: 70%; position: relative;">
<!-- START OF THE GUIDE -->
<h1>inputEx Guide</h1>
<p>This guide tries to centralize everything that has been written on inputEx. If you think something is missing or need better explanation, please contact us through the <a href="http://groups.google.com/group/inputex/">forum</a>. Being written by a french, help in finding typos, technical errors, or poorly worded sentences is greatly appreciated.</p>
<div id='index'>
<h2>Chapters</h2>
<ol class="topLevel">
<li>
<a href="#overview"><span>Overview</span></a>
<ul class="secondLevel">
<li><a href="#presentation">Presentation</a></li>
<li><a href="#htmlForms">HTML forms vs. JS/Ajax</a></li>
<li><a href="#terminology">Terminology</a></li>
</ul>
</li>
<li>
<a href="#GettingStarted"><span>Getting Started</span></a>
<ul class="secondLevel">
<li><a href="#installation">Installation</a></li>
<li><a href="#firstExample">First Example</a></li>
<li><a href="#directoryStructure">Directory structure</a></li>
<li><a href="#Instantiating">Instantiating a Field / the "type" property</a></li>
<li><a href="#metaFields">Meta Fields</a></li>
<li><a href="#insertDom">Insert a Field into the DOM</a></li>
<li><a href="#updatedEvent">The "updated" event</a></li>
</ul>
</li>
<li>
<a href="#AdvancedUsage"><span>Advanced Usage</span></a>
<ul class="secondLevel">
<li><a href="#visualization">Visualization</a></li>
</ul>
</li>
<li>
<a href="#CustomFields"><span>Create custom fields</span></a>
<ul class="secondLevel">
<li><a href="#customfieldsintro">Introduction</a></li>
<li><a href="#MarkupStructure">Markup Structure</a></li>
</ul>
</li>
<li>
<a href="#Contribute"><span>Contribute</span></a>
<ul class="secondLevel">
<li><a href="#Internationalization">Internationalization</a></li>
<li><a href="#ReportIssue">Reporting an Issue</a></li>
<li><a href="#ContributeDoc">Contributing to the Documentation</a></li>
<li><a href="#ContributeCode">Contributing to the Code</a></li>
<li><a href="#Contributors">Contributors</a></li>
</ul>
</li>
</ol>
</div>
<br /><br />
<a name="overview"><h1>1 Overview</h1></a>
<a name="presentation"><h2>1.1 Presentation</h2></a>
<p>inputEx is a javascript framework to build fields and forms.</p>
<p>It doesn’t use html markup (it is the opposite of obtrusive libraries): All the fields and forms are configured using json or javascript literal objects. It provides a very efficient abstraction for building interactive web applications. For detailed information, have a look at our complete <a href="api/index.html">API documentation</a>.</p>
<p>The code for inputEx is provided under <a href="license.txt">MIT license</a>.</p>
<a name="htmlForms"><h2>1.2 HTML forms VS. JS/Ajax</h2></a>
<p>While it is still possible to create forms using inputEx and send them using the browser, inputEx was made to build web applications. A preferable way to retrieve value is to use javascript and to send the value using ajax.</p>
<p>We use some hacks to make inputEx work with "standard" html forms :</p>
<ul>
<li>Usage of a "hidden" field to store the value</li>
<li>Naming conventions for objects</li>
</ul>
<a name="terminology"><h2>1.2 Terminology</h2></a>
<p>inputEx is built around the <b>Field</b> class. It is an <b>abstract</b> class (we <i>never</i> instantiate it).<br/>
All the other field classes inherits directly or indirectly from this base class. (see diagram below)</p>
<p>The important difference between "fields" and "widgets" is simple :</p>
<p><b>All fields inherit from the inputEx.Field class</b>
(some inherits it indirectly through other field classes...)</p>
<p>The inputEx.Field class provides a common set of methods that are expected to work on all fields.
This common abstraction makes it possible to nest standard fields into "meta"-fields (such as form, inplace-edit, ...)</p>
<p>The widgets are not meant to be inserted into forms. They are simply helpers to provide frequently-used
user interface using inputEx forms.</p>
<p>For example :
<ul>
<li>the dialog widget create a YUI dialog containing an inputEx Form.</li>
<li>the datatable extends the YUI datatable to use inputEx fields</li>
</ul>
</p>
<p>Finally inputEx.register only register fields.
This is necessary if you want to create a field using json: </p>
<pre class="brush:js">
fields: [
{type: "text", label:"name"},
{type: "my-custom-type", label: "test" }
]
</pre>
<p><u>Warning:</u> this diagram is not complete. See the API Doc for more information</p>
<center>
<img src="res/inputEx-class-diagram.png" />
</center>
<p></p>
<a name="GettingStarted"><h1>2 Getting Started</h1></a>
<a name="installation"><h2>2.1 Installation</h2></a>
<p>inputEx is just a bunch of static files (javascript files, css, and images). As usual, you will have to copy those files into your project directory.</p>
<ul>
<li><a href="http://github.com/neyric/inputex/downloads" target="_new">Download</a> the latest inputEx zip file</li>
<li>Copy the <i>js,css,images</i> directories into your project corresponding directories</li>
</ul>
<a name="firstExample"><h2>2.2 First Example</h2></a>
<h3>Add inputEx to your page</h3>
<p>3 ways of doing this :</p>
<ul>
<li>Using the YUI loader, include the inputEx loader (see <a href="../../examples/yuiloader.html">Using YUI loader</a> for requesting modules)
<pre class="brush:js">
<!-- YUI loader-->
<script src="http://yui.yahooapis.com/2.8.2r1/build/yuiloader/yuiloader-min.js"></script>
<!-- inputEx loader -->
<script src="../js/inputex-loader.js"></script>
</pre>
</li>
<li>Insert the script and CSS into your page : (inputEx+YUI)
<pre class="brush:js">
<!-- YUI utilities -->
<script src="http://yui.yahooapis.com/2.8.2r1/build/utilities/utilities.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/reset-fonts/reset-fonts.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/assets/skins/sam/skin.css" />
... and other yui dependencies...
<!-- inputEx -->
<link href="inputex/css/inputEx.css" rel="stylesheet" type="text/css" />
<script src="inputex/js/inputex.js" type="text/javascript"></script>
<script src="inputex/js/Field.js" type="text/javascript"></script>
<script src="inputex/js/Group.js" type="text/javascript"></script>
<script src="inputex/js/Form.js" type="text/javascript"></script>
<script src="inputex/js/fields/StringField.js" type="text/javascript"></script>
<script src="inputex/js/fields/CheckBox.js" type="text/javascript"></script>
... and the other fields you need ...
</pre>
</li>
<li>Use the minified files :
<pre class="brush:js">
<!-- YUI utilities -->
<script src="http://yui.yahooapis.com/2.8.2r1/build/utilities/utilities.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/reset-fonts/reset-fonts.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.2r1/build/assets/skins/sam/skin.css" />
... and other yui dependencies...
<!-- inputEx minified files -->
<script src="inputex/build/inputex-min.js" type="text/javascript"></script>
<link href="inputex/build/inputex-min.css" rel="stylesheet" type="text/css" />
</pre>
</li>
</ul>
<h3>Basic example</h3>
<ul>
<li>Create a DOM element that will contain your form:
<pre class="brush:xml">
<div id='myFormContainer'></div>
</pre>
</li>
<li>Create a basic form after loading:
<pre class="brush:js">
YAHOO.util.Event.addListener(window, "load", function(){
new inputEx.Form({
parentEl: 'myFormContainer',
fields: [],
buttons: []
});
});
</pre>
</li>
</ul>
<a name="directoryStructure"><h2>2.3 Directory structure</h2></a>
<table>
<thead>
<tr>
<th>file or directory</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>api/</td>
<td>Auto-generated <a href="api/index.html">API documentation</a></td>
</tr>
<tr>
<td>build/</td>
<td>Contains the minified javascript</td>
</tr>
<tr>
<td>css/</td>
<td>CSS files</td>
</tr>
<tr>
<td>examples/</td>
<td>Examples that are part of the library</td>
</tr>
<tr>
<td>images/</td>
<td>inputEx images</td>
</tr>
<tr>
<td>index.html</td>
<td>inputEx Home page</td>
</tr>
<tr>
<td>js/</td>
<td>javascript sources</td>
</tr>
<tr>
<td>lib/</td>
<td>librairies required by inputEx</td>
</tr>
<tr>
<td>license.txt</td>
<td>MIT license details</td>
</tr>
<tr>
<td>README.md</td>
<td>links for the GitHub page</td>
</tr>
<tr>
<td>res/</td>
<td>resources for inputEx website and documentation</td>
</tr>
<tr>
<td>scripts/</td>
<td>scripts to build rollup files and documentation</td>
</tr>
<tr>
<td>tools/</td>
<td>tools built for or with inputEx</td>
</tr>
<tr>
<td>version.txt</td>
<td>change log</td>
</tr>
</tbody>
</table>
<a name="directoryStructure"><h2>2.4 Instantiating a Field / the "type" property :</h2></a>
<p>There are 3 ways to instantiate a Field :</p>
<ul>
<li>Calling the class constructor (classic) :<br />
<pre class="brush:js">
var field = new inputEx.StringField({name: 'test'});
</pre></li><br />
<li>Using the inputEx function with the "type" construction:<br />
<pre class="brush:js">
var field = inputEx({ type: 'string', name: 'test' });
</pre></li><br/>
<li>Through a meta-field (see below)</li>
</ul>
<p>The default "type" associations : (<u>Warning:</u> this table is not complete, but each class follow the same naming conventions.)</p>
<style>
#associationTypes {
margin-left: 40px;
}
#associationTypes td {
width: 200px;
padding: 2px;
}
#associationTypes tr.odd {
background-color: #aaaaff;
}
#associationTypes th {
font-weight: bold;
text-align: center;
padding: 5px;
background-color: white;
}
</style>
<table id="associationTypes">
<thead>
<tr>
<th>type string</th>
<th>class</th>
<th>loader module</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>boolean</td>
<td>inputEx.CheckBox</td>
<td>inputex-checkbox</td>
</tr>
<tr>
<td>color</td>
<td>inputEx.ColorField</td>
<td>inputex-colorfield</td>
</tr>
<tr class="odd">
<td>date</td>
<td>inputEx.DateField</td>
<td>inputex-datefield</td>
</tr>
<tr>
<td>email</td>
<td>inputEx.EmailField</td>
<td>inputex-emailfield</td>
</tr>
<tr class="odd">
<td>form</td>
<td>inputEx.Form</td>
<td>inputex-form</td>
</tr>
<tr>
<td>group</td>
<td>inputEx.Group</td>
<td>inputex-group</td>
</tr>
<tr class="odd">
<td>hidden</td>
<td>inputEx.HiddenField</td>
<td>inputex-hiddenfield</td>
</tr>
<tr>
<td>html</td>
<td>inputEx.RTEField</td>
<td>inputex-rtefield</td>
</tr>
<tr class="odd">
<td>inplaceedit</td>
<td>inputEx.InPlaceEdit</td>
<td>inputex-inplaceedit</td>
</tr>
<tr>
<td>IPv4</td>
<td>inputEx.IPv4Field</td>
<td>inputex-ipv4field</td>
</tr>
<tr class="odd"><td>list</td>
<td>inputEx.ListField</td>
<td>inputex-listfield</td>
</tr>
<tr class="odd">
<td>password</td>
<td>inputEx.PasswordField</td>
<td>inputex-passwordfield</td>
</tr>
<tr>
<td>select</td>
<td>inputEx.SelectField</td>
<td>inputex-selectfield</td>
</tr>
<tr class="odd"><td>string</td>
<td>inputEx.StringField</td>
<td>inputex-stringfield</td>
</tr>
<tr>
<td>text</td>
<td>inputEx.Textarea</td>
<td>inputex-textarea</td>
</tr>
<tr class="odd"><td>type</td>
<td>inputEx.TypeField</td>
<td>inputex-typefield</td>
</tr>
<tr>
<td>uneditable</td>
<td>inputEx.UneditableField</td>
<td>inputex-uneditablefield</td>
</tr>
<tr class="odd">
<td>url</td>
<td>inputEx.UrlField</td>
<td>inputex-urlfield</td>
</tr>
</tbody>
</table>
<p>To link a class with a "type", we use :</p>
<pre class="brush:js">
inputEx.registerType(inputEx.StringField, 'string');
</pre>
<p></p>
<a name="metaFields"><h2>2.5 Meta-Fields :</h2></a>
<p>Some special fields called meta-fields take one or multiple "type" construction objects as configuration.</p>
<ul>
<li><b>Group</b>: A group of fields. It is itself a Field so it can be combined with any other field.</li>
<li><b>Form</b>: A group that provide ajax form capabilities.</li>
<li><b>List</b>: list of any subfield.</li>
<li><b>InPlaceEdit</b>: Make any subfield inplace-editable.</li>
<li><b>Typefield</b>: A special field that returns a config object to create an instance through the inputEx.buildField function. We create a form for each Field class to define the parameters for the specified field.</li>
</ul>
<p></p>
<a name="metaFields"><h2>2.6 Insert a Field into the DOM :</h2></a>
<p></p>
<pre class="brush:js">
var field = inputEx.FieldClass({...options...});
parentEl.appendChild( field.getEl() );
// or
var field = inputEx.FieldClass({...options..., parentEl: parentEl});
// or
var field = inputEx.FieldClass({...options..., parentEl: 'parentElId'});
</pre>
<p></p>
<a name="updatedEvent"><h2>2.7 The "updated" event :</h2></a>
<p>All the fields fire the same event when they are "updated".</p>
<p>To subscribe this event for a field, use : (see <a href="http://developer.yahoo.com/yui/event/#customevent" target="_new">YUI Custom Events</a> for more informations)</p>
<pre class="brush:js">
myField.updatedEvt.subscribe(function(e,value) {
// value = new value returned by getValue
...code here...
}, scope, true);
</pre>
<p>This event is fired when you use a setValue on the field. If you want to disable this behaviour, pass "false" as second argument to the setValue and the event won't be fired.</p>
<pre class="brush:js">
// This setValue won't fire the updatedEvt
myField.setValue("My Value", false);
</pre>
<a name="AdvancedUsage"><h1>3 Advanced Usage</h1></a>
<a name="visualization"><h2>3.1 Visualization</h2></a>
<h3>Introduction</h3>
<p>The use of a template engine in inputEx first appeared for the Autocompleter, InPlaceEdit and Uneditable fields.<br />
It has also proven very useful in projects that use inputEx.</p>
<p>The library itself doesn't include a template engine, but provides a standard way to use different engines and define your templates within field configurations. It is also very simple to add interfaces to other template engines.</p>
<h3>Rendering</h3>
<p>The fields should use the <strong>inputEx.renderVisu</strong> method to use templates:</p>
<p>Templating methods are stored in the <strong>inputEx.visus</strong> object. Methods can return either a HTMLElement or a String, since inputEx.renderVisu handle both.</p>
<p>inputEx.visus contains 3 default methods (you can add your own) :</p>
<ul>
<li><strong>dump</strong>: uses <a href="http://developer.yahoo.com/yui/docs/YAHOO.lang.html#method_dump">YAHOO.lang.dump</a> to generate a string from any object</li>
<li><strong>trimpath</strong>: use <a href="http://code.google.com/p/trimpath/wiki/JavaScriptTemplates">Trimpath JST template engine</a> (requires lib/trimpath-template-v.v.v.js)</li>
<li><strong>func</strong>: any function, useful for building interactive templates, cannot be described in json</li>
</ul>
<p>inputEx.Visus methods are functions that take 2 parameters :</p>
<ul>
<li>options: template object passed to Object containing the "visuType" property and template specific parameters</li>
<li>data: the data sent to the template</li>
</ul>
<br />
<h3>Examples</h3>
<p>Check the following examples to see template usage:</p>
<ul>
<li><a href="../../examples/autocomplete.html">Autocompleter</a></li>
<li><a href="../../examples/inplaceedit.html">InPlaceEdit</a></li>
<li><a href="../../examples/uneditable_field.html">UneditableField</a></li>
</ul>
<a name="CustomFields"><h1>4 Create custom fields</h1></a>
<a name="customfieldsintro"><h2>4.1 Introduction</h2></a>
<p>Once you've grasped the main ideas behind inputEx, you'll probably want to create your own fields. Here are some hints on how to do so :</p>
<div>
<p><b><u>Choose the right parent Class</u></b></p>
<p>Look at the classes to pick the "closest" one. (in terms of code)<br />
If you want to start from scratch, you should inherit from inputEx.Field</p>
<p>use <i>YAHOO.extend</i> to extend classes</p>
</div>
<div>
<p><b><u>Override methods</u></b></p>
<p>Some methods have a precise role :</p>
<ul>
<li><i>setOptions</i> : declare the options and their default value</li>
<li><i>render</i> : create a wrapper around the field DOM and insert the component</li>
<li><i>renderComponent</i> : render the DOM for your field</li>
<li><i>initEvents</i> : subscribe to events once rendered</li>
<li><i>getValue</i> : get the value of your field</li>
<li><i>setValue</i> : set the value of your field</li>
</p>
</div>
<div>
<p><b><u>Send the updated event</u></b></p>
<p>Fire this event to indicate modifications (with <i>this.fireUpdatedEvt()</i>)</p>
</div>
<div>
<p><b><u>Register your type</u></b></p>
<p>After your class definition, you can associate your class to a type string.
You can either create a new type, or override a previous one.</p>
<p>use <i>inputEx.registerType("myType", inputEx.MyFieldClass);</i></p>
</div>
<a name="MarkupStructure"><h2>4.2 Markup Structure</h2></a>
<p>Getting familiar with the inputEx markup structure will help a lot if you want to change CSS.</p>
<pre>
div.inputEx-fieldWrapper (+ state CSS classes)
// Label floating left
div.inputEx-label
label
// Field floating left
div.inputEx-Field
// field wrapper
div.inputEx-AnyField
// Description
div.inputEx-description
// Messages floating left
div.inputEx-message
// clear left floating
div.breaker
</pre>
<p>The "fieldWrapper" create a box that contains the entire field, labels, descriptions, widgets, etc...</p>
<p>The wrapper childNodes have the "float" css attribute set to "left" so you can decide where to break lines between them by using css: it gets much easier to put the label over the field, or the messages under etc...</p>
<a name="Contribute"><h1>5 Contribute</h1></a>
<a name="Internationalization"><h2>5.1 Internationalization</h2></a>
<p><strong>Usage</strong></p>
<p>The basic messages are stored into the <i>inputEx.messages</i> object :</p>
<pre class="brush:js">
inputEx.messages = {
required: "This field is required",
invalid: "This field is invalid",
valid: "This field is valid"
};
</pre>
<p>Additional fields should add their messages into the same object : </p>
<pre class="brush:js">
// Specific message for the email field
inputEx.messages.invalidEmail = "Invalid email, ex: sample@test.com";
</pre>
<p><strong>Contribute !</strong></p>
<p>We are looking for contributors to extend inputEx localizations. If you use inputEx in a foreign language, please contribute by sending the localization file <a href="http://groups.google.com/group/inputex/">on the forum</a>.</p>
<p><strong>Examples</strong></p>
<p>Then we only need one additional file, example with the <a href="fr.js.html">French translation file</a> :</p>
<pre class="brush:js">
/**
* InputEx French localization
*/
(function() {
var msgs = YAHOO.inputEx.messages;
msgs.required = "Ce champ est obligatoire";
msgs.invalid = "Ce champ n'est pas valide";
msgs.valid = "Ce champ est valide";
msgs.invalidEmail = "Email non valide; ex: michel.dupont@fai.fr";
msgs.selectColor = "Sélectionnez une couleur :";
msgs.invalidPassword = ["Le mot de passe doit contenir au moins "," caractères (lettres ou chiffres)"];
msgs.invalidPasswordConfirmation = "Les mots de passe entrés ne sont pas identiques !";
msgs.capslockWarning = "Attention: touche majuscule activée";
msgs.invalidDate = "Date non valide; ex: 25/01/2007";
msgs.defaultDateFormat = "d/m/Y";
msgs.shortMonths = ["Jan", "Fév", "Mars", "Avril", "Mai", "Juin", "Juil", "Août", "Sept", "Oct", "Nov", "Déc"];
msgs.months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
msgs.weekdays1char = ["D", "L", "M", "M", "J", "V", "S"];
msgs.shortWeekdays = ["Di","Lu","Ma","Me","Je","Ve","Sa"];
msgs.selectMonth = "- Choisissez -";
msgs.dayTypeInvite = "Jour";
msgs.monthTypeInvite = "Mois";
msgs.yearTypeInvite = "Année";
msgs.cancelEditor = "annuler";
msgs.okEditor = "Ok";
msgs.defautCalendarOpts = {
navigator: {
strings : {
month: "Choisissez un mois",
year: "Entrez une année",
submit: "Ok",
cancel: "Annuler",
invalidYear: "Année non valide"
}
},
start_weekday: 1 // la semaine commence un lundi
};
// Datatable
msgs.saveText = "Sauver";
msgs.cancelText = "Annuler";
msgs.modifyText = "modifier";
msgs.deleteText = "supprimer";
msgs.insertItemText = "Ajouter";
msgs.confirmDeletion = "Êtes-vous sûr ?"
})();
</pre>
<a name="ReportIssue"><h2>5.2 Reporting an Issue</h2></a>
<p>The issues/bugs and feature requests are managed through the <a href="http://github.com/neyric/inputex/issues">GitHub issue tracker</a>. Feel free to add new ones, vote for your favorites, comment on existing one, ...</p>
<p>Then don’t get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kind of bug, you’re creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to confirm it with a "I’m having this problem too" comment. <i>(shamelessly copied from Rails guide)</i></p>
<a name="ContributeDoc"><h2>5.3 Contributing to the Documentation</h2></a>
<p>This guide represents the biggest documentation effort of the library. The <a href="api/index.html">API documentation</a> is also a huge part of inputEx's documentation. How can you help ?</p>
<ul>
<li>fix typos, spelling</li>
<li>improve code documentation (and therefore the auto-generated API documentation)</li>
<li>write new examples</li>
<li>write about uncovered topics</li>
</ul>
<a name="ContributeCode"><h2>5.4 Contributing to the Code</h2></a>
<p>The easiest way for us to integrate your work into inputEx, is to fork the project on GitHub, and commit your changes into your own branch.</p>
<p>You can contribute in a lot of different ways :</p>
<ul>
<li>Design/Styling - images or css</li>
<li>Adapters/backend code</li>
<li>core contributions</li>
</ul>
<a name="Contributors"><h2>5.5 Contributors</h2></a>
<p>Special thanks to the major contributors :</p>
<ul>
<li><a href="http://github.com/neyric">neyric</a> - creator</li>
<li><a href="http://github.com/maximerety">maximerety</a> - co-founder</li>
<li><a href="http://github.com/piercus">piercus</a> - major contributions (fields, bug fixes, ideas, ...)</li>
</ul>
<p>And to other contributors :</p>
<ul>
<li><a href="http://github.com/rheimbuch">rheimbuch</a></li>
<li><a href="http://github.com/deduce">deduce</a></li>
<li><a href="http://github.com/abrin">abrin</a></li>
<li><a href="http://github.com/rmsguhan">rmsguhan</a></li>
<li><a href="http://github.com/mwschall">mwschall</a></li>
<li><a href="http://github.com/japaneseron">japaneseron</a></li>
<li><a href="http://github.com/joedeveloper">joedeveloper</a></li>
</ul>
</div>
<div style="font-size: 8pt; color: #999999; background-color: #222222; border-top: 2px solid black; padding: 10px; margin-top: 20px;">
<ul class="navigation">
<li><a href="http://neyric.github.com/inputex">Home</a></li>
<li><a href="http://github.com/neyric/inputex/">GitHub[Git]</a></li>
<li><a href="http://github.com/neyric/inputex/issues">Issues</a></li>
<li><a href="api/index.html">API Documentation</a></li>
<li><a href="guide.html">Guide</a></li>
<li><a href="http://neyric.com/category/inputex/">Blog</a>
<a href="http://neyric.com/feed/"><img src="res/rss.png" alt="rss icon"/></a></li>
<li><a href="http://groups.google.com/group/inputex/">Forums</a></li>
</ul>
<p style="font-size: 90%; margin-top: 20px;">inputEx is released under the <a href="license.txt" style="color: white;">MIT license</a>.</p>
</div>
</div>
<script type="text/javascript">
document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-567557-2");
pageTracker._trackPageview();
</script>
</body>
</html>