Questions tagged [ajax]

Use it for questions about JavaScript/PHP code to create asynchronous web applications.

Filter by
Sorted by
Tagged with
1 vote
3 answers
4k views

How to update multiple fields using ajax?

In content type there are three field . Each field are node reference to different content. Here I want to restrict value and create dependency on these field. For example: I have one auto complete ...
0 votes
1 answer
665 views

An error occured while attempting to process /ajax/ajax_facets/refresh:$.blockUI is not a function

Ajax facets work but I get an error "An error occured while attempting to process /ajax/ajax_facets/refresh:$.blockUI is not a function" when I click on ajax links with checkboxes for the facets for ...
0 votes
3 answers
456 views

Custom DOM placement using AJAX

I'm using unlimited image upload option in my content type. Upload image and remove the uploaded image options are working fine with the unlimited option. Usually, the uploaded images will be ...
0 votes
0 answers
22 views

Custom Ajax callback is not working within layout builder

I am using custom ajax callback inside an block form using form_alter but ajax functionality is not working within layout builder where as its working as expected while adding from structure -> ...
0 votes
1 answer
1k views

Ajax callback on Views exposed form filter

I'm trying to add an #ajax callback method to my views exposed form filter select box. But it seems the form have some issues with the callback. My code is pretty simple /** * Implements ...
0 votes
0 answers
7 views

Ajax Views DOM ID generation to fix Media Library Ajax View Exposed Form behaviours not getting rebound

I have a view with an exposed form with ajax enabled (is is media_library) I click apply filters. An ajax request is triggered and ViewAjaxController->ajaxView() runs. This method has a comment ...
1 vote
1 answer
837 views

Data not received on server in ajax

I'm trying to post data from ajax to php page which I made in the hook_menu, called "handler". So I have "domain.com/handler" which I try to do this in it: function handler(){ print_r($_POST); } ...
0 votes
1 answer
1k views

view exposed filter ajax error coming for non administrator user

I have event calendar module which is perfectly working fine. For some other users (non-admin users) I have to give permission to access events posted by them (They have permission to view the ...
0 votes
2 answers
568 views

How to get selected Value in the listbox by using form api

I have created a form with fields titled State and City. After selecting the state's appropriate city records, they will be loaded into city listbox. Until now they were working fine, but after ...
0 votes
1 answer
612 views

ajax modified form drop down doesn't save

I have used form_alter to add a ajax callback to an element to my form. When the user chooses an option, it creates dropdown options for the other field. However, while this works fine for changing ...
1 vote
1 answer
696 views

Integrating external web application

I have an existing web application written in Flask. I want to create a Drupal site that integrates this existing web application, so that the existing webapp will just be a back end, and the Drupal ...
0 votes
1 answer
1k views

How to redirect custom ajax form to external url with headers

When setting the form with ajax handler like this public function buildForm(array $form, FormStateInterface $form_state) { //... $form['actions']['submit'] = array( //... '#ajax'...
1 vote
2 answers
598 views

Expand views visible fields with ajax

I'm searching for a module that can expand the number of visible fields in a particular view result with a mouse click. I'm probably not searching with the good words because I only thing I found is ...
0 votes
1 answer
1k views

Render form with ajax submit

I have a custom form in a module, similar to this example: function mymodule_form($form, &$form_state) { $radio_options = array(...); $form = array(); $form["wrapper"] = array("#markup" =...
2 votes
1 answer
788 views

Search Api Autocomplete doesnt filter by language

We're using Search API Autocomplete with Search API 7.x-1.9 on a site set up with Solr (Websolr) serving nodes in both English and German. I'm looking to be able to filter the results by ...
4 votes
1 answer
972 views

Prevent dual submit on form submission

I've got a form that submits via AJAX and in the callback I need to rebuild certain parts of the page to reflect the newly submitted data. One of these parts is the form, which I need to clear all ...
0 votes
1 answer
1k views

How to configure a custom POST api to accept a request with Content-Type as "application/x-www-form-urlencoded" in the header?

I created a controller in a custom module that accepts a POST request. I have a setup such that I get a POST request from a third-party application server to this API. But the POST request has a ...
0 votes
1 answer
982 views

Custom Ajax forms with managed_file form element

We have a form with three fields - where depending on the value of the first select field, we will show the other two form elements - one select field (the options depends on the value of the first ...
1 vote
2 answers
418 views

Is it possible to turn off Ajax load for Commerce Coupon Module?

I am getting a bunch of issues with the Commerce Coupon module 7.x-2.0-rc3. Mainly there are inconsistencies with the forms updating and also intermittent timeouts. I'm assuming it's an Ajax load ...
0 votes
1 answer
454 views

Can I add elements to a field widget with AJAX?

I want to add fields depending on the first option selected. I also made a form with a similar behaviour but it wasn't a field widget. I used this module as an example to make the form I'm not sure if ...
1 vote
1 answer
709 views

Add custom ajax command to ajax response after webform is submitted

What I'm trying to do is to invoke some javascript after a webform is successfully submitted by ajax. To do that I followed this advice and created an EventSubscriber to intercept ajax response and ...
0 votes
1 answer
927 views

CORS localhost ajax request

I have an HTML page (http://localhost:8888/test/test.html) in which I'm trying to pull data from a Drupal 7 website. I'm using this AJAX code with HTML-Request. I have tried JSON and the website ...
0 votes
1 answer
2k views

How come my view block is not loading using ajax?

We have a view, myview, that has an exposed filter title (text input). The view has Exposed form in block:Yes and so we load it onto the page under admin/structure/block. The block has a machine name ...
3 votes
1 answer
610 views

Autocomplete term widget (tagging) - Insert as child

Is there a way to insert taxonomy terms as child of a parent term with the auto complete term widget? I have found several modules such as "Content Taxonomy" or "Hierarchical Term Reference ...
2 votes
1 answer
636 views

autofill from taxonomy term fields

I'm trying to connect a field of a taxonomy term to a field in a content type, something like this: Auto-Fill from on content type to another I tried this on a node and it's working, but now I have ...
0 votes
1 answer
1k views

Multiple Different AJAX Enabled Forms on the Same Page

I currently have a form that is being loaded by AJAX and is working perfectly. I now need to add a second form (Add Single Stat) to the same page via AJAX as well. The Add Single Stat form is being ...
3 votes
1 answer
1k views

how to change the size of an exposed filter autocomplete form?

the source shows: <input id="edit-field-location-taxonomize-terms-tid" class="form-text form-autocomplete ctools-auto-submit-processed" type="text" maxlength="128" size="60" value="Germany" name="...
3 votes
1 answer
2k views

Is there a way to load content of each tab in the view using AJAX?

I've created View to display my content and I'm using Quicktabs module https://drupal.org/project/quicktabs to format the output of this view into the tabs. Is there a way to load content of each ...
0 votes
1 answer
725 views

Use ajax to save modal / dialog form instead of page reload

I'm looking for a way to save modal & dialog forms through ajax instead of redirecting the user after the form submit. Ajax is quite unknown territory to me. I've found several interesting topics ...
3 votes
1 answer
674 views

Ajax webform: refresh page on a successful submission

I am using the ajax webform, because I don't want the page to be reloaded when the user doesn't enter everything correctly because my form slides in and reloading just causes it to disappear and you ...
0 votes
1 answer
897 views

Trying to pass id to the ajax callback function, keeps overwriting, how to solve this?

I created a form which have a lot of images and a delete button on every each one of them. I used ajax to create a callback function which would delete the image. Here is part of my form: foreach($...
1 vote
1 answer
423 views

Change mark-up with a textfield using Ajax

In a form I have a field where the user have to enter the name, after this I have to update a markup with data from an external DB using the textfield as a parameter, How can I do this or even Is this ...
0 votes
1 answer
428 views

How do I conditionally add a field?

I'm trying to find out any example of adding new conditional field using ajax in Drupal 8 form API, but I can't find it. This is my code. $form['name'] = array( '#type' => 'textfield', '#...
3 votes
2 answers
2k views

Add javascript to returned form after ajax validation

I've built a form with the form API, and it's submitting via ajax via this type of thing: $form['submit'] = array( '#type' => 'submit', '#value' => 'submit', '#ajax' => array( '...
1 vote
1 answer
679 views

How do I troubleshoot a jQuery/AJAX issue?

On a current Drupal Commerce installation, I just started experiencing issues where a field is not updating after a jQuery click event. When a user selects an option, the price typically updates for ...
0 votes
1 answer
584 views

Ajust the position of autocomplete fields

I working with the theme base bootstrap and my problem is that in autocomplete fields it's a bit offside of position, see the screenshot. How fix this ? I need this more to the left and below the ...
1 vote
1 answer
492 views

How to update one select element via Ajax when using node_add

I have just created a new content type called pieza_musical. What I just want to do is update one select element via Ajax depending on another select choice, a dependant select. I'm altering the ...
1 vote
1 answer
621 views

Making a REST AJAX call from Basic Page

The following successfully calls a REST Services Module endpoint when contained in a module but I cannot get it to work within the script tags of a basic page. (function ($) { var myapi = { '...
1 vote
1 answer
1k views

How to apply js and css to ajax loaded content?

When content get loaded through ajax, neither theme.css or js get applied. Below is code snippet, controller $twig = \Drupal::service('twig'); $twigFilePath = drupal_get_path('module', '...
1 vote
1 answer
688 views

How can I load content on the same page from a search

So the idea is to load the results of the search on the same page. I was told to look into SOLR, but it looks like we have something similar to SOLR , and we just need to know how to load new page ...
1 vote
0 answers
79 views

#ajax not triggering on textfield or any fieldtype other then select

I'm completely clueless about the problem. I have tried to google but have not found any similar issues. My AJAX callbacks work only on the select field type, but I want to trigger ajax on textfield ...
0 votes
0 answers
34 views

How do I use the tempstore service?

I'm storing some values in array and sending to the drupal through Ajax and receiving it through the controller. In the controller i am using the following code to retrieve and trying to store using ...
1 vote
2 answers
642 views

Loading a View Through Ajax - Slideshow not showing

I have a view in node-view mode that has another view (a view slideshow) embedded into that view. I am using jquery and setTimeout to slideDown the hidden div that contains the view a few seconds ...
1 vote
1 answer
705 views

Multiple forms on page

I am trying to get multiple forms to work in a views display. All of the forms uses AJAX, but they appear to be interfering with each other. One form is the Views Bulk Operations form that turns the ...
1 vote
1 answer
564 views

Form field not show on Ajax Callback even the callback is called

I have a form with one shown field of type select with ajax callback to show another form field dynamically of type select and with ajax callback again, the problem is second field ajax callback ...
1 vote
1 answer
1k views

Inline entity form ajax

I am trying to update some field options in an inline entity form with ajax. This should happen, when someone selects a value in an other field. I already have some code which "works", but the ...
0 votes
2 answers
620 views

Save form when user refreshes page from browser or click on any anchor tag inside page

I have made a form in drupal. What I want is when the browser unload the page from any click whether by clicking on anchor tag or from browser refresh buttons I want to save data of my form through ...
0 votes
1 answer
847 views

How do I avoid behaviors are invoked after an AJAX call?

I have a search result page, with the first set of data being fetched during the page load, and we add a Load More button. Clicking on this button fires an AJAX call, using the ajax_links_api module. ...
0 votes
2 answers
3k views

How can I set form values with Ajax?

I want to set the value of a textfield based upon the selection of a field above. You can choose a template and the textfield would have it as a value. This is the select field used to select the ...
0 votes
1 answer
1k views

Table Pager Rendered in an Ajax Callback Shows White Page

I have the callback function below that renders a table with a pager. Every page of the table is 20 rows. Below is the code: function myid_print_all_submitted_id_callback($form, &$form_state){ ...

1
2 3 4 5
51