source: trunk/plugins/Forms/popups/input.html @ 236

Last change on this file since 236 was 236, checked in by gocher, 14 years ago

new elements for plugin forms
file, fieldset, label

and for existing elements more attributes

File size: 5.6 KB
Line 
1<html>
2
3<head>
4  <title>Insert/Edit Form Element INPUT</title>
5  <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
6  <script type="text/javascript" src="../../../popups/popup.js"></script>
7
8<script type="text/javascript">
9var fields = null;
10var type;
11function Init() {
12  __dlg_translate("Forms");
13        __dlg_init();
14        var param = window.dialogArguments;
15  type = param.f_type;
16  document.getElementById("f_type").innerHTML = 'Form Element: INPUT (' + type + ')';
17  document.getElementById("txt").style.display = "none";
18  document.getElementById("chk").style.display = "none";
19  document.getElementById("btn").style.display = "none";
20  document.getElementById("img").style.display = "none";
21  switch (type) {
22    case "text":
23    case "password":
24      fields = ["f_name", "f_value", "f_readonly", "f_disabled", "f_tabindex", "f_accesskey", "f_size"];
25      height = 350;
26      document.getElementById("txt").style.display = "block";
27      break;
28    case "checkbox":
29                case "radio":
30      fields = ["f_name", "f_value", "f_checked", "f_disabled", "f_tabindex", "f_accesskey"];
31      document.getElementById("chk").style.display = "block";
32      height = 280;
33      break;
34                case "button":
35      fields = ["f_name", "f_value", "f_disabled", "f_onclick", "f_tabindex", "f_accesskey"];
36      document.getElementById("btn").style.display = "block";
37      height = 300;
38            break;
39                case "file":
40      fields = ["f_name", "f_disabled", "f_tabindex", "f_accesskey"];
41      document.getElementById("f_value").disabled = true;
42      height = 280;
43      break;
44    case "image":
45      fields = ["f_name", "f_disabled", "f_tabindex", "f_accesskey", "f_src"];
46      document.getElementById("img").style.display = "block";
47      document.getElementById("f_value").disabled = true;
48      height = 300;
49      break;
50    case "reset":
51    case "submit":
52      fields = ["f_name", "f_value", "f_disabled", "f_tabindex", "f_accesskey"];
53      height =260;
54      break;
55    case "hidden":
56      fields = ["f_name", "f_value"];
57      document.getElementById("f_disabled").disabled = true;
58      document.getElementById("f_tabindex").disabled = true;
59      document.getElementById("f_accesskey").disabled = true;
60      height =260;
61      break;
62  }
63  for (var i in fields) {
64    switch (fields[i]) {
65    case "f_readonly":
66    case "f_disabled":
67    case "f_checked":
68      document.getElementById(fields[i]).checked = param[fields[i]]=="true"; break;
69    default:
70      document.getElementById(fields[i]).value = param[fields[i]]; break;
71    }
72  }
73  window.resizeTo(320,height);
74        document.getElementById("f_name").focus();
75};
76
77function onOK() {
78        var el = document.getElementById("f_name");
79        if (!el.value) {
80        alert("You must enter a Name");
81                el.focus();
82          return false;
83        }
84  // pass data back to the calling window
85  var param = new Object();
86  param["f_type"] = type;
87  for (var i in fields) {
88    switch (fields[i]) {
89    case "f_readonly":
90    case "f_disabled":
91    case "f_checked":
92      param[fields[i]] = (document.getElementById(fields[i]).checked)?"true":""; break;
93    default:
94      param[fields[i]] = document.getElementById(fields[i]).value; break;
95    }
96  }
97  __dlg_close(param);
98  return false;
99};
100
101function onCancel() {
102        __dlg_close(null);
103        return false;
104};
105</script>
106<style rel="stylesheet" type="text/css">
107DIV.line        {       clear: both;    }
108
109LABEL   {
110        padding-top: 3px;
111        padding-left: 3px;             
112        padding-right: 3px;     
113        }
114       
115LABEL.label     {
116        float: left;
117        width: 8em;
118        text-align: right;
119        }       
120</style> 
121</head>
122
123<body onload="Init()">
124  <div id="f_type" class="title"></div>
125  <form action="" method="get">
126    <div class="fr">Name/ID:</div>
127    <input type="text" name="name" id="f_name" title="Name of the form input" />
128    <p />
129    <div class="fr">Value:</div>
130    <input type="text" name="value" id="f_value" title="Value of the form input" />
131    <p />
132    <div class="fr">Disabled</div>
133    <input type="checkbox" name="disabled" id="f_disabled" value="disabled" />
134    <p />
135   
136  <div id="chk">
137    <div class="fr">Checked</div>
138      <input name="checked" id="f_checked" type="checkbox" />
139    <p />
140        </div>
141         
142    <div class="fr">Tab Index:</div>
143    <input type="text" name="tabindex" id="f_tabindex" />
144    <p />
145    <div class="fr">Access Key:</div>
146    <input type="text" name="accesskey" id="f_accesskey" />
147    <p />
148
149  <div id="txt">
150    <div class="fr">Read Only</div>
151    <input type="checkbox" name="readonly" id="f_readonly" value="readonly" />
152    <p />
153   
154          <fieldset>
155        <legend>Dimensions</legend>
156      <div class="space"></div>
157      <div class="fr">Size:</div>
158      <input type="text" name="size" id="f_size" size="5" title="Size of text box in characters" />
159      <div class="space"></div>
160      <div class="fr">Max length:</div>
161      <input type="text" name="maxlength" id="f_maxlength" size="5"     title="Maximum number of characters accepted" />
162      <div class="space"></div>
163          </fieldset>
164  </div>
165  <div id="btn">
166          <fieldset>
167          <legend> Button Script</legend>
168            <div class="space"></div>
169      <div class="fr">'onClick'=</div>
170      <input type="text" name="onClick" id="f_onclick" title="Javascript for button click" />
171      <div class="space"></div>
172          </fieldset>
173  </div>
174        <div id="img">
175          <fieldset>
176          <legend>Image source</legend>
177            <div class="space"></div>
178      <div class="fr">Image URL:</div>
179      <input type="text" name="src" id="f_src" title="URL of image" />
180      <div class="space"></div>
181          </fieldset>
182  </div>
183  <div id="buttons">
184    <button type="button" name="ok" onclick="return onOK();">OK</button>
185    <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
186  </div> 
187</form>
188
189</body>
190</html>
Note: See TracBrowser for help on using the repository browser.