Changeset 46196

Show
Ignore:
Timestamp:
06/05/06 11:02:10 (4 years ago)
Author:
madarche
Message:

- Fixed #1653: Search box always clearing text.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • CPS3/products/CPSPortlets/trunk/CHANGES

    r46190 r46196  
    77Bug fixes: 
    88~~~~~~~~~~ 
     9- Fixed #1653: Search box always clearing text. 
    910- Made the search portlet more accessible through the use of a label tag. 
    1011New internal features: 
  • CPS3/products/CPSPortlets/trunk/skins/cpsportlets_widgets/widget_portlet_search.pt

    r46190 r46196  
    1111                  folder_prefix request/folder_prefix|nothing; 
    1212                  cpsmcat nocall:here/translation_service; 
    13                   value_search 
    14                     request/SearchableText|python:cpsmcat('button_search'); 
     13                  search_label python:cpsmcat('button_search'); 
     14                  previous_search_value request/SearchableText|string:; 
     15                  search_value python:previous_search_value or search_label; 
    1516                  base_url python:request.get('cpsskins_base_url');" 
    1617 method="get" action="" 
     
    4344    <img tal:attributes=" 
    4445         src string:${base_url}cpsskins_images/portlet_search_icon.png; 
    45          alt value_search" /> 
     46         alt search_label" /> 
    4647  </label> 
    47   <input id="searchGadget" type="text" name="SearchableText" size="15" 
    48     value="" tal:attributes="value value_search" 
    49     onclick="this.value='';"/> 
     48  <input id="searchGadget" type="text" name="SearchableText" size="15" value="" 
     49         tal:attributes="value search_value; 
     50                         onclick python:'blankSearchFormInput(\'%s\', this)' 
     51                         % previous_search_value; 
     52      "/> 
    5053  <input class="context searchButton" type="submit" value="button_ok" 
    5154    i18n:attributes="value" /> 
  • CPS3/products/CPSPortlets/trunk/skins/cpsportlets_widgets/widget_portlet_search_js.pt

    r12658 r46196  
     1/** 
     2 * Blank the search form input only if there isn't any ongoing search. 
     3 */ 
     4function blankSearchFormInput(previousSearchValue, formElem) { 
     5    if (previousSearchValue == '') { 
     6        formElem.value = ''; 
     7    } 
     8} 
     9 
     10/** 
     11 * Return whether the search form is empty or not. 
     12 * This script is to be used to avoid to request a search for an empty request, 
     13 * to save the server from useless load. 
     14 */ 
    115function checkEmptySearch(formElem) { 
    216    var query = trim(formElem.SearchableText.value); 
     
    1024} 
    1125 
     26/** 
     27 * Return a copy of the string with leading and trailing characters removed. 
     28 */ 
    1229function trim(s) { 
    1330    if (s) {