Minor Cosmetic Changes
| Project: | Stock |
| Version: | 4.6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | minor |
| Assigned: | kbahey |
| Status: | closed |
Jump to:
In the course of playing around with the "Stock" module, I ran into some items that aren't bugs but simply limitations that should probably be changed to make the module more useful.
Items:
1. The form's "maxlength" setting is far lower than the maximum amount of data the DB will store for a single user. The default "maxlength" value is 64 characters. The default amount of data the "symbols" field will hold (in MySQL) is 128.
2. I wanted to track more stocks than the default DB setting would allow.
3. If the "maxlength" setting is increased, the length of the actual text field on the HTML form should be made wider to facillitate entering larger numbers of stock symbols.
The changes I made on my site are as follows:
Code modifications in the "stock_form" function in the file "stock.module":
<?php
function stock_form ( $symbols )
{
global $user;
// The following 1 line was commented out by SLACK1661 06/01/05
// $output .= form_textfield ( t("Stock Symbol(s)"), "symbol", "$symbols", 33, 64);
// The following 1 line was added by SLACK1661 06/01/05
$output .= form_textfield ( t("Stock Symbol(s)"), "symbol", "$symbols", 99, 255);
$output .= form_submit (t("Quote"), "button_quote");
// If user is logged in, then give them a Save button
if ( $user->uid )
{
$output .= form_submit (t("Save"), "button_save");
}
$form = form($output);
return $form;
}
?>Also, the default size of the field "symbols" in the {stock} table should be changed from "varchar(128)" to "varchar(255)". See sample "database.mysql" file below:
--
-- Table structure for table 'stock'
--
CREATE TABLE stock (
uid int(10) NOT NULL default '0',
symbols varchar(255) NOT NULL default '',
PRIMARY KEY (uid)
) TYPE=MyISAM;I have attached a screen shot to this submission with all of the changes implemented.
If more clarification is needed for any of the above information, please drop me a line.
| Attachment | Size |
|---|---|
| snapshot1_0.png | 416.81 KB |

#1
Good observation. I changed the maximum to 255, so you can fit those many stocks you have.
The default width is now 40 instead of 99. I do not want to make it that wide because some people may be using low resolution screens, and it would be too wide for them.
I guess you can increase it in your own copy if you want.
#2