Changeset 1374
- Timestamp:
- 20/11/09 10:19:41 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/basic-controls.js
r1365 r1374 91 91 92 92 93 // OutputControl - displays the value as text. 94 $.inherit(OutputControl, kf.Control); 95 /** 96 * @class Specific ControlType for simple output (wrapped in a <span/>) 97 * @param {String} id 98 * @param {Form} form 99 * @param {Object} conf 100 * @extends $.org.kauriproject.forms.Control 101 * @constructor 102 */ 103 function OutputControl( id, form, conf) { 104 105 this['<super.init>'](id, form, conf); 106 } 107 108 /** 109 * Holds the configuration parameters for finding/creation control bound HTML elements per relation 110 * @type Object 111 */ 112 OutputControl.prototype.elements = {}; 113 $.extend(OutputControl.prototype.elements, kf.Control.prototype.elements); 114 $.extend(OutputControl.prototype.elements, { 115 input : { 116 create :"<span/>", 117 select :"span" 118 } 119 }); 120 121 /** 122 * Specific control element initialisation 123 * @param {Boolean} create Creates the elements if they don't exist yet 124 */ 125 OutputControl.prototype.initElements = function( create) { 126 127 var $output = this.getElement(); 128 129 //default 130 if (!this.html) 131 this.html = false; 132 133 } 134 135 /** 136 * Reads the value that was entered by the user. 137 * @return The user value 138 */ 139 OutputControl.prototype.getUserValue = function() { 140 141 var $input = this.getElement(); 142 return $input[this.html?'html':'text'](value); 143 } 144 /** 145 * Reads the value that was entered by the user. 146 * @param {Object} value The user value 147 */ 148 OutputControl.prototype.setUserValue = function( value) { 149 150 value = value || ""; 151 var $input = this.getElement(); 152 $input[this.html?'html':'text'](value); 153 } 154 155 93 156 $.inherit(CheckBoxControl, kf.Control); 94 157 … … 389 452 controlTypes.putAll( { 390 453 "input-control" :InputControl, 454 "output-control" :OutputControl, 391 455 "checkbox-control" :CheckBoxControl, 392 456 "selection-control" :SelectionControl, trunk/samples/kauri-forms-sample/src/main/kauri/pages/basic-controls1.html.xml
r1353 r1374 33 33 control: 'textarea-control', 34 34 label: 'Describe yourself in 10 words' 35 }, 36 'tip-of-the-day1': { 37 base: 'string', 38 control: 'output-control', 39 label: 'Tip of the day' 40 }, 41 'tip-of-the-day2': { 42 base: 'string', 43 control: { 44 "base": 'output-control', 45 "html": true 46 }, 47 label: 'Tip of the day2' 35 48 } 36 37 49 } 38 50 }}; … … 45 57 window.location = "grid.html"; 46 58 }; 59 basicForm.setWireValue({ 60 "tip-of-the-day1":"Today, it will be colder than outside.", 61 "tip-of-the-day2":"Don\'t <b>worry</b>, be <b>happy</b>!" 62 }); 47 63 }); 48 64 </script> … … 91 107 <td><span kauri-idref="description" kauri-role="messages"/></td> 92 108 </tr> 109 <tr> 110 <td><label kauri-role="label" kauri-idref="tip-of-the-day"/></td> 111 <td><span style="width:200px;height:150px" kauri-idref="tip-of-the-day" kauri-role="input"/></td> 112 <td><span kauri-idref="tip-of-the-day" kauri-role="messages"/></td> 113 </tr> 114 <tr> 115 <td><label kauri-role="label" kauri-idref="tip-of-the-day2"/></td> 116 <td><span style="width:200px;height:150px" kauri-idref="tip-of-the-day2" kauri-role="input"/></td> 117 <td><span kauri-idref="tip-of-the-day2" kauri-role="messages"/></td> 118 </tr> 93 119 </tbody> 94 120 </table>
