Removed default size from form fields

This commit is contained in:
Tobi Schäfer 2015-01-28 20:13:27 +01:00
parent e2fe90126b
commit 2acff557d0

View file

@ -19,7 +19,7 @@
* @fileoverview Fields and methods of the helma.Html * @fileoverview Fields and methods of the helma.Html
* and helma.Html.Tablewriter classes. * and helma.Html.Tablewriter classes.
* <br /><br /> * <br /><br />
* To use this optional module, its repository needs to be added to the * To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/helma/Html.js') * application, for example by calling app.addRepository('modules/helma/Html.js')
*/ */
@ -58,7 +58,7 @@ helma.Html.renderMarkupPart = function(name, start, end, attr) {
res.write(name); res.write(name);
if (attr) { if (attr) {
for (var i in attr) { for (var i in attr) {
if (i == "prefix" || i == "suffix" || if (i == "prefix" || i == "suffix" ||
i == "default" || attr[i] == null) { i == "default" || attr[i] == null) {
continue; continue;
} }
@ -267,9 +267,7 @@ helma.Html.prototype.input = function(param) {
return; return;
} }
var attr = Object.prototype.reduce.call(param); var attr = Object.prototype.reduce.call(param);
attr.type = "text"; attr.type = param.type || "text";
if (!attr.size)
attr.size = 20;
attr.value = (attr.value != null) ? encodeForm(attr.value) : ""; attr.value = (attr.value != null) ? encodeForm(attr.value) : "";
this.tag("input", attr); this.tag("input", attr);
return; return;
@ -404,7 +402,7 @@ helma.Html.prototype.submit = function(param) {
attr.name = attr.type; attr.name = attr.type;
attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type; attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type;
this.tag("input", attr); this.tag("input", attr);
return; return;
}; };
/** /**
@ -435,7 +433,7 @@ helma.Html.prototype.button = function(param) {
attr.name = attr.type; attr.name = attr.type;
attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type; attr.value = (attr.value != null) ? encodeForm(attr.value) : attr.type;
this.tag("input", attr); this.tag("input", attr);
return; return;
}; };
/** /**
@ -454,8 +452,8 @@ helma.Html.prototype.buttonAsString = function(attr) {
/** /**
* Renders a x/html drop down select box * Renders a x/html drop down select box
* @param {Object} param An object containing the tag attributes * @param {Object} param An object containing the tag attributes
* @param {Array} options Either an array of strings, an array with * @param {Array} options Either an array of strings, an array with
* several <code>{value: v, display: d}</code> objects, or a collection * several <code>{value: v, display: d}</code> objects, or a collection
* of <code>["value", "display"]</code> arrays in an array * of <code>["value", "display"]</code> arrays in an array
* @param {String} selectedValue The value to pre-select * @param {String} selectedValue The value to pre-select
* @param {String} firstOption An optional first option to display in the * @param {String} firstOption An optional first option to display in the
@ -467,8 +465,6 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
return; return;
} }
var attr = Object.prototype.reduce.call(param); var attr = Object.prototype.reduce.call(param);
if (!attr.size)
attr.size = 1;
this.openTag("select", attr); this.openTag("select", attr);
res.write("\n "); res.write("\n ");
if (firstOption) { if (firstOption) {
@ -518,8 +514,8 @@ helma.Html.prototype.dropDown = function(param, options, selectedValue, firstOpt
/** /**
* Returns a rendered x/html drop down select box * Returns a rendered x/html drop down select box
* @param {Object} param An object containing the tag attributes * @param {Object} param An object containing the tag attributes
* @param {Array} options Either an array of strings, an array with * @param {Array} options Either an array of strings, an array with
* several <code>{value: v, display: d}</code> objects, or a collection * several <code>{value: v, display: d}</code> objects, or a collection
* of <code>["value", "display"]</code> arrays in an array * of <code>["value", "display"]</code> arrays in an array
* @param {String} selectedValue The value to pre-select * @param {String} selectedValue The value to pre-select
* @param {String} firstOption An optional first option to display in the * @param {String} firstOption An optional first option to display in the
@ -656,7 +652,7 @@ helma.Html.prototype.tableAsString = function(headers, data, attr) {
/** /**
* Renders an x/html opening link tag * Renders an x/html opening link tag
* @param {Object} attr An object containing the tag attributes * @param {Object} attr An object containing the tag attributes
*/ */
helma.Html.prototype.openLink = function(attr) { helma.Html.prototype.openLink = function(attr) {
this.openTag("a", attr); this.openTag("a", attr);
@ -665,7 +661,7 @@ helma.Html.prototype.openLink = function(attr) {
/** /**
* Returns an x/html opening link tag * Returns an x/html opening link tag
* @param {Object} attr An object containing the tag attributes * @param {Object} attr An object containing the tag attributes
* @returns The rendered open link tag * @returns The rendered open link tag
* @type String * @type String
* @see #openTag * @see #openTag
@ -758,8 +754,6 @@ helma.Html.prototype.password = function(attr) {
return; return;
} }
attr.type = "password"; attr.type = "password";
if (!attr.size)
attr.size = 20;
this.tag("input", attr); this.tag("input", attr);
return; return;
}; };