+++ This bug was initially created as a clone of Bug #532391 comment 2 +++ There are several pairs of fields of the pattern: checkbox and numeric field. The numeric field is only enabled when the checkbox is enabled. Examples of such pair is the "check for new messages every X minutes" or "ask me before downloading X messages". Some of the fields have some checks whether the entered value is correct and within sane boundaries. Some of the fields do not have such check. The purpose of this bug is to build a shared set of checks and add the checks where they are missing. The proposed model of operation for those fields: - the numeric fields will have 'type="number" size="X" min="X" increment="X"' as appropriate. This makes the widget itself sanitize values read from prefs.js into the specified boundaries. It does not allow the user to input values outside the boundaries. It adds the small arrow widgets to increase/decrease the value. - the checkbox field will have an oncommand function that will enable/disable the corresponding numeric field depending on the state of the checkbox. Open questions: - should 0 still be allowed in some fields as a special value? It was used to disable the checkbox automatically if 0 is entered (in "Check for new messages every X days"). - should max= attribute be added to the numeric fields to disallow some insane values? Like 10000000 minutes? It would need decision what are insane values and whether the backend would choke on them. The plan: - merge the onCheckItem function from am-server.js and am-offline.js and move it into amUtils.js . - update the field declarations where needed and make them call the onCheckItem function. - the fields where these checks need update are for example: a) RSS "Check for new articles every X minutes" b) POP3/News (Synch & storage) "Messages larger than X KB" c) POP3/News (Synch & storage) "Messages more than X days old" d) Junk mail "automatically delete junk mail older than X days" etc.
The common function was moved to am-prefs.js per comment https://bugzilla.mozilla.org/show_bug.cgi?id=755454#c4. The resulting patch from all this would be too big so I am doing some panels in separate bugs (linked here).