Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6178105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:24:22+00:00 2026-05-24T00:24:22+00:00

I am adding some autocomplete on a form alter. The problem is that in

  • 0

I am adding some autocomplete on a form alter. The problem is that in the callback, only the string in the textfield The autocomplete is on, is available. I also want to access a value from another textfield in the callback. How is this possible ?

/**
 * Implements hook_form_alter().
 */
function webform_conversion_jquery_form_webform_client_form_1_alter(&$form, &$form_state, $form_id) {
          //Load some extra function to process data
        module_load_include('inc', 'webform_conversion_jquery', '/includes/dataqueries');

        //Add extra js files
        drupal_add_js(drupal_get_path('module', 'webform_conversion_jquery') . '/js/conversionform.js');
        $form['submitted']['correspondentadress']['cor_street']['#autocomplete_path'] = 'conversionform/conversion_street';
    }
}

/**
 * Implements hook_menu().
 */
function webform_conversion_jquery_menu() {
    $items = array();


    $items['conversionform/conversion_street'] = array(
        'title' => 'Conversion street autocomplete',
        'page callback' => 'conversion_street_autocomplete',
        'access callback' => 'user_access',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}

/**
 * Retrieve a JSON object containing autocomplete suggestions for streets depending on the zipcode.
 */
function conversion_street_autocomplete($street = '') {
    $street = "%" . $street . "%";
    $matches = array();
    $result = db_select('conversion_adresslist')
                    ->fields('conversion_adresslist', array('street'))
                    ->condition('street', $street, 'like')
                    ->execute();
    foreach ($result as $street) {
        $matches[$street->street] = $street->street;
    }
    drupal_json_output($matches);
}

I just want to be able to post extra information in the function:

conversion_street_autocomplete($street = '', $extraparameter)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:24:23+00:00Added an answer on May 24, 2026 at 12:24 am

    Ok, for as far as I can see it is not possible. maybe you can roll your own with the ajax functionality in fapi http://api.drupal.org/api/drupal/developer–topics–forms_api_reference.html/7#ajax

    For now I solved it by implementing jquery.ui.autocomplete which is included in drupal 7

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm adding some JCheckBox components to a JPanel at runtime. My problem is that
I'm adding some functionality to my site so that users can upload their own
I'm looking into adding some unit tests for some classes in my data access
Adding some gui modifications and I want to have a button which is 10pixels
I'm adding some custom buttons to my forms in MS Access, but somehow I
Iam adding some text content to nsmutablestring in the form of dictionary format and
i am getting adding some of parameter in query string.value of these param can
I'm adding some new functionality to a Firefox plugin that is recording actions user
I am adding some functionality to the HtmlHelper-class. Basically I want to automatically disable
My company is adding some rich calendar functionality to our Swing application. We want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.