Default value for project filter is not set when using select

claudiu.cristea - October 15, 2009 - 13:58
Project:Localization server
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:claudiu.cristea
Status:closed
Description

The #default_value is not correctly set on filter forms when select is used instead of autocomplete.

This is happen because in l10n_community_filter_form() the value is set

<?php
   
'#default_value' => isset($filters['project']) ? $filters['project']->title : '',
?>

but when select is used the value passed should be $filters['project']->uri not $filters['project']->title.

This patch fixes this bug.

AttachmentSize
l10n_server_project_filter-D6.patch1.54 KB

#1

Gábor Hojtsy - October 15, 2009 - 14:36

We tried to use the same data handling, so the select should ideally use the title too, which would fix this problem in a different way to make it consistent.

#2

Gábor Hojtsy - October 15, 2009 - 14:36
Status:needs review» needs work

#3

claudiu.cristea - October 15, 2009 - 15:05

To me, the URI is something more consistent. I'm not sure that the project title is unique but the URI surely is.

We can:

  • Use the URI. Use "node like" approach... On node autoselects we use: "Title [nid:$nid]". Maybe we want to use for projects autocomplete "Title [URI]" and use the URI.
  • Use Title. Store the Title in select option's value.

#4

Gábor Hojtsy - October 15, 2009 - 15:16

The autocomplete will only ever get us the title, so using the same data in the select would be useful.

#5

claudiu.cristea - October 15, 2009 - 15:42
Status:needs work» needs review

Voila! Replaced the URI with Title in option's value attribute.

AttachmentSize
l10n_server_project_filter1-D6.patch 803 bytes

#6

Gábor Hojtsy - November 6, 2009 - 15:30
Status:needs review» fixed

Thanks, committed this one.

#7

System Message - November 20, 2009 - 15:40
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.