var inputs = $fields ?? [ ];
var button = $button ?? 'Ok';
var channel = $publish ?? 'default';
<form>
<table id=(@form)>
foreach (var input in inputs where !input.hidden) {
var type = input.type ? (string.tolower(input.type)) : "text"; // default to 'text'
<tr>
<td> input.label ?? string.nbsp </td>;
<td>
if (type == "text")
<input type="text" name=(input.field) value=(input.value) size=(input.size ?? 16) />;
else if (type == "select")
<select name=(input.field)>
foreach (var opt in input.value) <option value=(opt)> opt </option>;
</select>;
else if (type == "radio") {
foreach (var opt in input.value) {
if (__index && input.oneperline) <br />;
<input type="radio" name=(input.field) value=(__index)> " "..opt.." " </input>;
}
}
else if (type == "checkbox")
<input type="checkbox" name=(input.field) value=(input.value) />;
else
<span style="color:red"> "ERROR: unknown input type '"..type.."'" </span>;
</td>
</tr>
}
<tr>
<td>
foreach(var input in inputs where input.hidden) {
<input type="hidden" name=(input.field) value=(input.value) />
}
</td>
<td align="right">
<input type="button" value=(button ?? 'Ok') ctor="when($this.click) {
var m = { };
Deki.$('#' + {{@form}}).find('input,select').each(function() {
var type = $(this).attr('type');
if (!((type == 'radio' || type == 'checkbox') && !$(this).attr('checked')) &&
Deki.hasValue(this.name)) m[this.name] = Deki.$(this).val();
});
Deki.publish({{channel}}, { {{user.name}}:m });
}" />
</td>
</tr>
</table>
</form>
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by