add AJAX name again from one other AJAX end in a type

I wish to use 2 AJAX name again inside a type. Drupal Developer state of affairs is like I’m having a textual content area and a Search button which is outlined in Drupal Development Company type alter operate. After getting into a textual content and clicking on Drupal Development Company Search button, will show some matching strings with another info from database as an HTML in ul li a format.

I had made every string as a type aspect hyperlink and displaying beneath Drupal Development Company search area. Now, I want so as to add AJAX callback to this hyperlink and after clicking on any string, Drupal Development Company entire HTML content material needs to be eliminated and another new textual content fields ought to be displayed in Drupal Development Company type and Drupal Development Company chosen string ought to be positioned on Drupal Development Company textual content area.

Please see beneath codes.

FORM ALTER

  $type['searchbutton'] = array(       '#kind' => 'button',       '#worth'=> t('Search'),       '#id'   => 'search_button',       '#ajax' =>  array(           'callback' => 'ajax_search_callback',           'wrapper' => 'search-list-wrapper',           'technique' => 'exchange',           'impact' => 'fade',           'progress' => array('kind' => 'none'),         )      ); 

Beneath code is Drupal Development Company first AJAX name on button click on

/**      * AJAX name again       */ operate ajax_search_callback($type, $form_state) {  //getting matching record from database with respect to look textual content // $search_results   $type['link-lists'] = array(         '#kind' => 'merchandise',                       '#prefix' => "<ul>",         '#suffix' => "</ul>",     );  foreach ($search_results as $key => $end result) {         $result_html = "<p class="matching-title">" . $end result['title'] . "</p>                 <p class="matching-desc">" . $end result['description'] . "</p>";          $type['link-lists']['options'.$key] = array(             '#kind' => 'hyperlink',             '#prefix' => "<li class="matching-list-item">",             '#suffix' => "</li>",             '#title' => $result_html,             '#href' => '#',             '#choices' => array(               'html' => true,             ),             '#ajax' => array(               'wrapper' => 'search-list',               //'technique' => 'html',               'callback' => 'select_ajax_callback',             )       );    }   $instructions = array();   $instructions[] = ajax_command_replace('#descriptions-list', drupal_render($type['link-lists']));   $web page = array('#kind' => 'ajax', '#instructions' => $instructions);   return $web page;   } 

I feel, Drupal Development Company second AJAX name again select_ajax_callback given for Drupal Development Company type merchandise hyperlink isn’t appropriate. It might be grateful if anybody can assist me on beneath questions?

  1. set callback for a type merchandise hyperlink? Please appropriate me.
  2. How I’ll get $type and $form_state values in Drupal Development Company operate select_ajax_callback. And on this operate I have to return one other type aspect which is already outlined in Drupal Development Company type alter.

Thank You.

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

add AJAX name again from one other AJAX end in a type

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.