| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> |
| 5 |
<title>Testing SimpleTextArea | The Dojo Toolkit</title> |
| 6 |
|
| 7 |
<style type="text/css"> |
| 8 |
@import "../../themes/claro/document.css"; |
| 9 |
@import "../css/dijitTests.css"; |
| 10 |
</style> |
| 11 |
|
| 12 |
|
| 13 |
<link id="themeStyles" rel="stylesheet" href="../../../dijit/themes/claro/claro.css"/> |
| 14 |
|
| 15 |
|
| 16 |
<script type="text/javascript" src="../../../dojo/dojo.js" |
| 17 |
data-dojo-config="isDebug: true, parseOnLoad: true"></script> |
| 18 |
|
| 19 |
|
| 20 |
<script type="text/javascript" src="../_testCommon.js"></script> |
| 21 |
|
| 22 |
<script type="text/javascript"> |
| 23 |
dojo.require("dijit.dijit"); // optimize: load dijit layer |
| 24 |
dojo.require("dijit.form.SimpleTextarea"); |
| 25 |
|
| 26 |
// needed for tests |
| 27 |
dojo.require("dijit.layout.BorderContainer"); |
| 28 |
</script> |
| 29 |
</head> |
| 30 |
|
| 31 |
<body class="claro" style="padding:20px" role="main"> |
| 32 |
|
| 33 |
<h1 class="testTitle">SimpleTextarea</h1> |
| 34 |
|
| 35 |
<p> |
| 36 |
This is a simple text area that doesn't automatically size itself according to it's content. |
| 37 |
It can be used inside layout containers. |
| 38 |
</p> |
| 39 |
|
| 40 |
<h2><label for="ta1">Plain textarea (rows=5, cols=50), selectOnClick=true</label></h2> |
| 41 |
<textarea id="ta1" data-dojo-type="dijit/form/SimpleTextarea" data-dojo-props='name:"ta1", rows:"5", cols:"50", |
| 42 |
onFocus:function(){ console.log("user focus handler") }, |
| 43 |
onBlur:function(){ console.log("user blur handler") }, |
| 44 |
onChange:function(val){ dojo.byId("oc1").value = "" + val; }, |
| 45 |
selectOnClick:true |
| 46 |
'> |
| 47 |
shichashaw, textarea text baw. |
| 48 |
</textarea> |
| 49 |
<label for="oc1">onChange:</label><textarea id="oc1" rows="6" cols="50" disabled >not fired yet!</textarea> |
| 50 |
<span style='white-space:nowrap;'> |
| 51 |
<button id="resetButton" onclick="dijit.byId('ta1').reset();">reset</button> |
| 52 |
<button id="setNullButton" onclick="dijit.byId('ta1').set('value', null);">set value to null</button> |
| 53 |
<button id="getValueButton" onclick="dojo.byId('gv1').value=''+dijit.byId('ta1').get('value');">get value</button> |
| 54 |
<textarea id="gv1" rows="6" cols="50" disabled aria-label="hi">no value yet!</textarea> |
| 55 |
</span> |
| 56 |
|
| 57 |
|
| 58 |
<h2><label for="ta2">Plain textarea with style="height: 300px; width: 300px" rows="" cols=""</label></h2> |
| 59 |
<textarea id="ta2" data-dojo-type="dijit/form/SimpleTextarea" data-dojo-props='name:"ta2", |
| 60 |
style:{height:"300px", width:"300px"}, rows:"", cols:""'>I have a style setting rather than rows/cols setting</textarea> |
| 61 |
|
| 62 |
<h2>In a BorderContainer</h2> |
| 63 |
|
| 64 |
<div id="container" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props='style:{width:"500px", height:"400px", border:"inset gray 3px"}'> |
| 65 |
<textarea id="top" data-dojo-type="dijit/form/SimpleTextarea" aria-label="top" data-dojo-props='name:"top", region:"top", splitter:true, style:{height:"100px"}'> |
| 66 |
This is just some text in the top region. |
| 67 |
</textarea> |
| 68 |
<textarea id="left" data-dojo-type="dijit/form/SimpleTextarea" aria-label="left" data-dojo-props='name:"left", region:"left", splitter:true, style:{width:"200px"}'> |
| 69 |
This is just some text in the left region. |
| 70 |
</textarea> |
| 71 |
<textarea id="center" data-dojo-type="dijit/form/SimpleTextarea" aria-label="center" data-dojo-props='name:"center", region:"center"'> |
| 72 |
This is just some text in the center region. |
| 73 |
</textarea> |
| 74 |
<textarea id="right" data-dojo-type="dijit/form/SimpleTextarea" aria-label="right" data-dojo-props='name:"right", region:"right", splitter:true, style:{width:"200px"}'> |
| 75 |
This is just some text in the right region. |
| 76 |
</textarea> |
| 77 |
<textarea id="bottom" data-dojo-type="dijit/form/SimpleTextarea" aria-label="bottom" data-dojo-props='name:"bottom", region:"bottom", splitter:true, style:{height:"100px"}'> |
| 78 |
This is just some text in the bottom region. |
| 79 |
</textarea> |
| 80 |
</div> |
| 81 |
|
| 82 |
<script> |
| 83 |
function setAttr(attr, value){ |
| 84 |
dijit.registry.byClass('dijit.form.SimpleTextarea').forEach(function(widget){ widget.set(attr, value);}); |
| 85 |
} |
| 86 |
</script> |
| 87 |
<input type="button" onclick="setAttr('readOnly', false);" value="Remove readOnly"/> |
| 88 |
<input type="button" onclick="setAttr('readOnly', true);" value="Set readOnly"/> |
| 89 |
<input type="button" onclick="setAttr('disabled', true);" value="Disable"/> |
| 90 |
<input type="button" onclick="setAttr('disabled', false);" value="Enable"/> |
| 91 |
</body> |
| 92 |
</html> |