Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-401

Problems with custom fields and advanced searches


    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:


      Several types of custom fields need to be modified when they are rendered in the Advanced Search form (i.e. when they are marked 'searchable') in order to prevent the user from being forced to include them in the submitted search critieria:

      1. Radio buttons
      1.1 Change the logic so that NONE of the options are checked when the form is initially displayed
      1.2 Automatically add a link - "unselect" to the right of each radio button option group. This link calls a jscript function in Common.js (link and code below)

      2. Select fields
      2.1 Automatically and a null option to these form elements and set it as default: <option value="" selected>- select -</option>

      3. Date fields
      3.1 Custom date fields should be transformed into a From/To pair of date selector sets with the usual null options included. EXAMPLE:

      Date Last Voted: From [month] [day] [year] To [month] [day] [year]

      ---- Link for radio 'unselect' (replace fieldName w/ current radio field name, formName w/ this form's name) -------
      <a href="#" title="unselect" onclick="unselectRadio(fieldName, formName); return false;" >unselect</a>

      ---- Jscript for radio 'unselect' -------
      function unselectRadio(fieldName, form)
      for( i=0; i < document.forms[form].elements.length; i++) {
      if (document.forms[form].elements[i].name == fieldName)

      { document.forms[form].elements[i].checked = false; }


      — Original bug report from Jack Aponte ------------
      I've created some custom fields with radio buttons for which I've designated a default choice, as well as some date fields.

      These fields are messing up advanced searches, making them completely inaffective. The fields that have a designated default choice are automatically included in the search (the search searches for contacts that have the default choice selected), even if I've not even expanded their custom data section. The custom date fields also get searched for, despite not having chosen to search based on those fields.

      Here's the result I get when searching the database. The only search option that I actually selected was to search for all contacts who are Individuals.

      No matches found for:
      ? Contact Type - Individual
      ? Voter Info: Needs an absentee ballot? - "0"
      ? Voter Info: Needs a ride to the polls? - "0"
      ? Membership: Is this person a member? - "0"
      ? Membership: Membership Start Date - , ,
      ? Membership: Dues - Last Payment Date - , ,




            • Assignee:
              lobo Donald A. Lobo
              jackatlinc Jack Aponte
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: