Kmenger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/198296

Change subject: FormLayout: Add description, example, and mark private method
......................................................................

FormLayout: Add description, example, and mark private method

Change-Id: I327ac743705ea2bb2bdb4a04d6f5918c74111820
---
M src/layouts/FormLayout.js
1 file changed, 41 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/96/198296/1

diff --git a/src/layouts/FormLayout.js b/src/layouts/FormLayout.js
index 8c0d151..edb2a2c 100644
--- a/src/layouts/FormLayout.js
+++ b/src/layouts/FormLayout.js
@@ -1,5 +1,41 @@
 /**
- * Layout with an HTML form.
+ * FormLayouts are used to wrap {@link OO.ui.FieldsetLayout FieldsetLayouts} 
when you intend to use browser-based
+ * form submission for the fields instead of handling them in JavaScript. Form 
layouts can be configured with an
+ * HTML form action, an encoding type, and a method using the #action, 
#enctype, and #method configs, respectively.
+ *
+ *     @example
+ *     // Example of a form layout that wraps a fieldset layout
+ *     var input1 = new OO.ui.TextInputWidget( {
+ *         placeholder: 'Username'
+ *     } );
+ *     var input2 = new OO.ui.TextInputWidget( {
+ *         placeholder: 'Password',
+ *         type: 'password'
+ *     } );
+ *     var submit = new OO.ui.ButtonInputWidget( {
+ *         label: 'Submit'
+ *     } );
+ *
+ *     var fieldset = new OO.ui.FieldsetLayout( {
+ *         label: 'A form layout'
+ *     } );
+ *     fieldset.addItems( [
+ *         new OO.ui.FieldLayout( input1, {
+ *             label: 'Username',
+ *             align: 'top'
+ *         } ),
+ *         new OO.ui.FieldLayout( input2, {
+ *             label: 'Password',
+ *             align: 'top'
+ *         } ),
+ *         new OO.ui.FieldLayout( submit )
+ *     ] );
+ *     var form = new OO.ui.FormLayout( {
+ *         items: [ fieldset ],
+ *         action: '/api/formhandler',
+ *         method: 'get'
+ *     } )
+ *     $( 'body' ).append( form.$element );
  *
  * @class
  * @extends OO.ui.Layout
@@ -10,7 +46,7 @@
  * @cfg {string} [method] HTML form `method` attribute
  * @cfg {string} [action] HTML form `action` attribute
  * @cfg {string} [enctype] HTML form `enctype` attribute
- * @cfg {OO.ui.FieldsetLayout[]} [items] Items to add
+ * @cfg {OO.ui.FieldsetLayout[]} [items] Fieldset layouts to add to the form 
layout.
  */
 OO.ui.FormLayout = function OoUiFormLayout( config ) {
        // Configuration initialization
@@ -46,6 +82,8 @@
 /* Events */
 
 /**
+ * A 'submit' event is emitted when the form is submitted.
+ *
  * @event submit
  */
 
@@ -58,6 +96,7 @@
 /**
  * Handle form submit events.
  *
+ * @private
  * @param {jQuery.Event} e Submit event
  * @fires submit
  */

-- 
To view, visit https://gerrit.wikimedia.org/r/198296
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I327ac743705ea2bb2bdb4a04d6f5918c74111820
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Kmenger <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to