Results 1 to 7 of 7

Thread: SerchForm inputs go blank after search?

  1. #1
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default SerchForm inputs go blank after search?

    I swear I've read somthing on this before but can't seem to find it now.

    I have added several custom search fields in Contacts/SearchForm.html, and all return expected results -- except that
    (unlike the form's default first_name, last_name, and account_name fields) my search fields -- the inputs themselves --
    return empty within the search form making it difficult to remember what search criteria were entered in the first place and so,
    difficult to make sense of the results returned.

    What do I need to edit to makemy search fields behave like the default first/last_name search fields
    and return the values entered before clicking search?

    SugOS 4.0.1f

  2. #2
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: SerchForm inputs go blank after search?

    Well over a month later, and I'm still left scratching my head over this one.
    I should clarify that the "custom" fields were hard coded into the modules (Accounts & Contacts), and not via the
    studio editor. That said, even OEM fields such as "address_postalcode" do not return populated with values searched.

    For example, in Accounts/SearchForm.html the field "name" when searched returns the value entered in the input, however the field "address_postalcode" does not, though both return the desired results in listView.

    HTML Code:
    <input type=text tabindex='1' size="30" name="name" class=dataField  value="{NAME}" />
    <input type=text tabindex='2' size="5" name="address_postalcode" class=dataField value="{ADDRESS_POSTALCODE}" />
    In listView.php we have...
    PHP Code:
    if(isset($name) && $name != ""array_push($where_clauses"accounts.name like '".PearDatabase::quote($name)."%'");
    // AND
    if(isset($address_postalcode) && $address_postalcode != ""array_push($where_clauses"(accounts.billing_address_postalcode like '".PearDatabase::quote($address_postalcode)."%' OR accounts.shipping_address_postalcode like '".PearDatabase::quote($address_postalcode)."%')"); 
    Clearly, upon search -- the settings are placed in cache (somewhere?), as one must click the "clear" button to change search parameters, while by appearance of the SearchForm.html custom fields (in which ever module) appear to be already cleared. Can anyone suggest a starting place? How do we get "custom" or additional search fields to remain populated until cleared?
    Last edited by tj@estreet.com; 2006-11-30 at 06:55 PM.

  3. #3
    Skipidar is offline Sugar Community Member
    Join Date
    Oct 2006
    Location
    Russia, Moscow
    Posts
    27

    Default Re: SerchForm inputs go blank after search?

    Hi, i'm not sure how it MUST BE, but i know how to help you in your case
    Open ListView.php

    after if(isset($_REQUEST['query'])) {
    add
    if(isset($_REQUEST['yourfield_c'])) $search_form->assign("YOURFIELD_C", $_REQUEST['yourfield_c']);
    yourfiled - is your custom field maybe it's not the best solution but it works
    Working on integration...

  4. #4
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: SerchForm inputs go blank after search?

    Thanks Skipidar,
    Unfortunately, these are all already set my in listview.php.
    Also, I should reiterate that these fields are not "custom" in the Sugar_c sense and so defiined say.. in table accounts_cstm,
    but rather have been hard coded into the accounts module itslef. (see below).

    PHP Code:
        if (isset($_REQUEST['address_postalcode'])) $address_postalcode $_REQUEST['address_postalcode'];
    // address_postalcode is OEM -- default Sugar code


        
    if(isset($_REQUEST['active'])) $active $_REQUEST['active'];
        if(isset(
    $_REQUEST['flag'])) $flag $_REQUEST['flag'];
        if(isset(
    $_REQUEST['zone'])) $zone $_REQUEST['zone'];
        if(isset(
    $_REQUEST['mao'])) $mao $_REQUEST['mao'];// MAO stands for multi-agent-office 
    which, as stated above, all return search results just fine, it's just that the html inputs do not return populated in searchform.html.

    As for address_postal code, I simply coppied the field from the "advanced search table" in searchform.html, to the basic search table" and just moments ago discovered that a search on postalcode from basic field does in fact return populated upon switching to the advanced search view. Digging in, I discovered that adding...

    if (isset($address_postalcode)) $search_form->assign("ADDRESS_POSTALCODE", to_html($address_postalcode));
    AFTER
    if (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') { ...
    allows results in address_postalcode field to return pouplated after search in basic search table, however corrisponding lines of code for the remaining fields in question were already set there, and yet do not return populated in basic following a search so .... GRRRRRRRRR!

    PHP Code:
    if (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
        
    // Stick the form header out there.
        
    $search_form=new XTemplate ('modules/Accounts/SearchForm.html');
        
    $search_form->assign("MOD"$current_module_strings);
        
    $search_form->assign("APP"$app_strings);
        
    $search_form->assign("IMAGE_PATH"$image_path);
        
    $search_form->assign("ADVANCED_SEARCH_PNG"get_image($image_path.'advanced_search','alt="'.$app_strings['LNK_ADVANCED_SEARCH'].'"  border="0"'));
        
    $search_form->assign("BASIC_SEARCH_PNG"get_image($image_path.'basic_search','alt="'.$app_strings['LNK_BASIC_SEARCH'].'"  border="0"'));
        
    $search_form->assign("JAVASCRIPT"get_clear_form_js());

        if (isset(
    $name)) $search_form->assign("NAME"to_html($name));
    //adding the following, postalcode field returns populated upon search from basic field
        
    if (isset($address_postalcode)) $search_form->assign("ADDRESS_POSTALCODE"to_html($address_postalcode));
    //however these do not, and were already set upon adding the initially  
        
    if (isset($zone)) $search_form->assign("ZONE"to_html($zone));
        if (isset(
    $visits)) $search_form->assign("VISITS"to_html($visits));
        if (isset(
    $visit_by)) $search_form->assign("VISIT_BY"to_html($visit_by));
        if (isset(
    $flag)) $search_form->assign("FLAG"to_html($flag));
        if (isset(
    $active)) $search_form->assign("ACTIVE"to_html($active));
        if (isset(
    $mao)) $search_form->assign("MAO"to_html($mao)); 

  5. #5
    tj@estreet.com is offline Sugar Community Member
    Join Date
    Feb 2006
    Posts
    163

    Default Re: SerchForm inputs go blank after search?

    A little more info nobody really wants to read...

    see comments in code
    PHP Code:
    //updateing the following ("checked") -- postalcode, flag and active now return populated upon search from basic field
        
    if (isset($address_postalcode)) $search_form->assign("ADDRESS_POSTALCODE"to_html($address_postalcode));
        if (isset(
    $flag)) $search_form->assign("FLAG""checked");
        if (isset(
    $active)) $search_form->assign("ACTIVE""checked");

    //however these do not 
        
    if (isset($zone)) $search_form->assign("ZONE"to_html($zone)); // html select IN searchform.html
        
    if (isset($visits)) $search_form->assign("VISITS"to_html($visits)); // simple text input like NAME field.
        
    if (isset($mao)) $search_form->assign("MAO"to_html($mao)); // simple text input like NAME field.
    // while NAME returns populated in searchform name field..
        
    if (isset($name)) $search_form->assign("NAME"to_html($name)); 
    still struggling... any insight appreciated

  6. #6
    Skipidar is offline Sugar Community Member
    Join Date
    Oct 2006
    Location
    Russia, Moscow
    Posts
    27

    Default Re: SerchForm inputs go blank after search?

    Do you have this params in searchform.html?

    like <input name='address_postalcode' value={ADDRESS_POSTALCODE}> ?
    Working on integration...

  7. #7
    applematt84 is offline Junior Member
    Join Date
    Nov 2006
    Posts
    3

    Default Re: SerchForm inputs go blank after search?

    i'm having the same problem with my custom fields. i created a couple custom fields (for SIC numbers and descriptions) and want my marketing staff to be able to search by these. the search results return just fine, but the data entered into the HTML form is cleared when the page reloads. the field data is in the url in the address bar, but it's like the form is not grabbing the data that's handed back to it, so that the person doing the query knows what they queried by.

    now i'm just rambling. if anyone could help us, it'd be greatly appreciated! :-)

    cheers!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •