drupal-ajax

Drupal 7 Forms API - AJAX Forms error: An illegal choice has been detected. Please contact the site administrator

旧城冷巷雨未停 提交于 2019-12-24 04:49:05
问题 I have a form set up where a users selects an item from a drop down. Once that item is selected another drop down is populated. Then depending on the value that is selected from the second drop down a fieldset may or may not be shown. If the field set is shown there is a field and a button. By clicking the button you add another copy of the same field. Once there is more than one a remove one button shows up as well. I got the basis for the code from here: http://api.drupal.org/api/examples

Drupal 7 FAPI - ajax image preview

僤鯓⒐⒋嵵緔 提交于 2019-12-21 06:38:56
问题 I am trying to preview the uploaded image using ajax in my D7 module but don't know why it's not working. Here is what I am trying to do:- function create_ad_form($form, &$form_state) { $form['image_file'] = array( '#title' => t('Upload Banner:'), '#type' => 'file', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Submit', '#submit' => array('create_ad_form_submit'), '#ajax'=> array( 'callback'=>'create_ad_form_submit', 'wrapper'=> 'im-area', 'method'=> 'replace', 'effect'=>

Loading views_accordion through an ajax request

故事扮演 提交于 2019-12-13 02:56:08
问题 I am currently loading my view through an ajax request in my custom module: $.getJSON('/reports/summarized-progress/get_output_activities/'+nid, null,activities); The drupal page for the above request returns the following: $output_arg=arg(3); $html=""; $activities=views_embed_view('activities','block_activities',$output_arg); //this returns a view accordion view if(!empty($activities)) { $html.=''; $html.=$activities; $html.=''; } drupal_json_output(array('data'=>$html)); The accordion

Why should I use Drupal's Form API & Ajax framework for this rather than just implementing my own solution with calling node_save()?

橙三吉。 提交于 2019-12-11 23:07:40
问题 I want users to be able to submit nodes and comments via AJAX. I also want to do some fairly extensive customization of the node and comment forms. I've spent time looking through documentation and code examples for Drupal 7's Form API and Ajax framework, but I find it very complex. Therefore, I simply want to create my own form in HTML and use my own JavaScript code to submit it via Ajax. I'll also set up a specific URL for processing these Ajax requests, which will ultimately call node_save