List selection in profile will not allow a 0 value as the first item
zoon_unit - March 27, 2007 - 19:58
| Project: | Drupal |
| Version: | 7.x-dev |
| Component: | profile.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
If one uses the profile module to make a list selection box that contains numbers, if the first number in the list is a zero, it will not appear as a selection. (however, listing the number as <0>, works)

#1
In fact this a little worse than that, it doesn't accept 0 at all.
The problem is in code like this:
<?phpif ($line = trim($line)) {
?>
When line equal 0, we have if (0) which is FALSE so this value is omitted. Should we write:
I'm not sure on how to correct this (with clean code I mean).
<?php
$line = trim($line);
if (!empty($line) || $line == '0') {
//or something like that:
if (strlen($line = trim($line)) != 0) {
?>
#2
The same problem if you want to accept an empty string.
I want the first line to accept an empty string. This is specially usefull for required fields.
I want the user to select a value when it is a required field. Now the first value is automatically selected which is not correct.
#3
Any news about this?