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?
- set callback for a type merchandise hyperlink? Please appropriate me.
- 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.