| Anonymous | Login | Signup for a new account | 21-11-09 08:52 GMT |
| Main | My View | View Issues | Change Log | Roadmap | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Print ] | ||||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||
| 0004215 | [phplist] Interface - Frontend | minor | always | 01-10-05 00:45 | 18-02-08 14:08 | ||
| Reporter | colinangel | View Status | public | ||||
| Assigned To | |||||||
| Priority | normal | Resolution | fixed | ||||
| Status | resolved | Product Version | 2.10.2 | ||||
| Summary | 0004215: Default values for radio buttons in attributes not honored | ||||||
| Description |
When using attributes, if a default value for a radio button is set, the subscription form does not actually default to the value specified. The code from admin/subscribelib2.php uses "isset", but the variables being checked are ALWAYS set to 0, so the final "default" clause of the IF statement never takes effect. if (isset($_POST[$fieldname])) $checked = $_POST[$fieldname] == $value["id"] ? "checked":""; else if (isset($data[$attr["id"]])) $checked = $data[$attr["id"]] == $value["id"] ? "checked":""; else $checked = $attr["default_value"] == $value["name"] ? "checked":""; |
||||||
| Additional Information | |||||||
| Tags | No tags attached. | ||||||
| Attached Files | |||||||
|
|
|||||||
Relationships |
||||||
|
||||||
Notes |
|
|
(0011780) lukejackson (reporter) 25-03-06 10:34 |
One way to fix it is to make the following changes in admin/subscribelib2.php, search for all three instances of: if (isset($_POST[$fieldname])) and replace them with: if ($_POST[$fieldname] != 0) search for all three instances of : else if (isset($data[$attr["id"]])) and replace them with: else if ($data[$attr["id"]] != "") it can be seen that only a few lines before this code, there is a check to see whether the two variables are not set, and if so to set them. this then breaks the code immediately below! the other way to fix it therefore would be to remove that code and then make any necessary changes to the following code that is affected. the above solution is much simpler. |
|
(0011781) lukejackson (reporter) 25-03-06 10:35 |
this is also a problem for check box groups and drop down lists. the above solution fixes these too. |
|
(0030384) h2b2 (reporter) 12-08-07 01:16 |
This issue may need reviewing as it has been raised again for ver. 2.10.4. See this forum thread: http://forums.phplist.com/viewtopic.php?t=11137 [^] |
|
(0030385) michiel (administrator) 12-08-07 02:20 |
instead of "isset" it should use "!empty" which will evaluate to false, if the var is 0 or "", but it will not throw warnings on non-initialised variables. in phplist a lot of code is in the form if ($var) { something } which for PHP is not a nice way to do it, as it has security implications, so in those cases it's better to use if (!empty($var)) { something } Hernan, can you check this ? |
|
(0030455) hernan (developer) 13-08-07 17:48 |
Yes, changed two instances of if ($var) { something } to if (!empty($var)) { something } For select and radio butttons. |
| Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |