Questions tagged [ajax]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

managed_file - get ajax_submit of Upload/Remove button

I have a managed_file form field. Is there a way to add more functionality to the Upload/Remove buttons of that field, like modifying the ajax_submit of these buttons? For example, if the Remove ...
-2
votes
0answers
14 views

How to make dropdown in front view drupal 8 [on hold]

i have developed drupl8 site .How to make city dropdown? Not for a menu dropdown.
1
vote
0answers
16 views

Incorrect User data being loaded after save

I am running into some data inconsistencies when attempting to load user data after saving the data. Basically, I have a callback that will update a field on the current user object. In a simplified ...
0
votes
1answer
25 views

Auto-submit exposed form

I'm currently working on a views exposed form block. I want the form to auto-submit using AJAX, whenever an exposed filter is changed. I have searched for this, but I couldn't find any tutorial or ...
0
votes
2answers
42 views

Run validation callback before ajax

The submit element on my form uses an ajax callback which sends out an email. I have a validation callback which I've added to this form, but it gets run after the ajax callback and so the email will ...
0
votes
0answers
32 views

Remove a widget item with an Ajax callback (in an entity browser widget)

[edit to add]: 1-The ajax callback is made from a field (field_company) inside the regular user_form 2-The logic and the callback definition reside inside the hook_form_alter of the user_form => ...
1
vote
1answer
30 views

where to put addCommand when implement ajax callback commands

i' m trying to load a dynamic value on every node of my site and i want to achieve this via ajax callback commands and writing custom module so i have a class in src/ajax folder of module like: ...
0
votes
0answers
18 views

Reload only view content on changing exposed filters [on hold]

I am using Better Exposed Filter Module to get filtered rows of view, on every change on filters form (select with cities). Unfortunetly, the response is the whole .js-view-dom-id-xxx, so all my ...
0
votes
1answer
38 views

Adding #ajax callbacks to form elements in HOOK_form_alter()

I'm trying to add an #ajax callback to a select element on a form that is created in another module on a Drupal 8.x site. When I add the #ajax callback using HOOK_form_alter() in my module, the Ajax ...
0
votes
0answers
11 views

Get replaced element value in ajax

On ajax callback I have replaced value on with replaceCommand> Value was displaying on browser but , while i have clicked on radios again and ajax callback again It will fetch the same old 1000 value ...
0
votes
0answers
28 views

What should I use instead of ajax_render()?

I want to create AJAX pagination on Drupal 8. With Drupal 7, I used the following code. $result = theme('load_more_friend_suggestions', array('friends' => $friends_list, 'info' => array('...
0
votes
0answers
21 views

Ajax based form doesn't work on new from element [duplicate]

I am creating some dynamic form element based on the dropdown selection. There are max 3 dropdowns and I want to run ajax on each dropdown on change event. When I clicked on the first dropdown(Level ...
1
vote
1answer
32 views

Focus problem when Ajax call for multiple fields calling the same callback function

I have implemented a custom form. I put same Ajax callback function for multiple field. When one Ajax call completes, I click on other field. But I can't unfocused previous field. Sometimes the Ajax ...
0
votes
0answers
17 views

Ajax in a template file to show the value of session variable

I have a webform in my node.tpl which action points to hook_menu url of a module. When the form submit happens, it compiles the form data in the custom module and stores the response value in a ...
0
votes
0answers
26 views

AJAX in callback function

I'm trying to convert old code written in standard HTML/PHP/Javascript/JQuery into a format (more) consistent with Drupal. The code consists of a form with interactive elements (regulated by ...
-1
votes
1answer
32 views

AJAX not working in views for anonymous users [closed]

I have a view in Drupal 8 with an exposed form with AJAX enabled. It works fine for admin user, but it doesn't for anonymous users. I have included in my theme libraries file: dependencies: - core/...
1
vote
1answer
28 views

What is the progress bar periodic update function return data?

In Drupal 7 from the function called with 'url/to/call/progressbar/update/function' (see below) you would return an array converted to JSON like this: drupal_json_output($message); I cannot find any ...
0
votes
0answers
16 views

Cannot get form values set in a ajax callback

In the hook_form_alter, I add 3 textfield form elements and 1 button with ajax callback: function zwznertags_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'book_node_form') { ...
0
votes
0answers
18 views

How to maintain two domains in the same installation having different $base_url

I have published a new domain for my drupal installation. It has a fixed $base_url configured in settings.php. For example: https://www.olddomain.com.ar . It throws an ajax exception when I use a ...
0
votes
0answers
11 views

Search result page with tabs and ajax pagination

I need to create a results search page with those characteristics: The page will have different tabs (like the bootstrap ones so no page reload), each tab will only shows the relative content type. ...
0
votes
1answer
26 views

How can i add ajax callback to checkbox in drupal form?

I am using taxonomy manager module I want to add ajax callback to checkbox tree view for checkbox is checked condition but it is not working can some one please suggest me. I have modified the code ...
0
votes
0answers
15 views

How to fill a multi-value term reference field in a ajax callback in a node add/edit form?

The machine name of the term reference field is "field_persons", using the autocomplete_deluex widget. function zwznertags_form_alter(&$form, &$form_state, $form_id) { if($form_id == '...
1
vote
0answers
20 views

scrolling after posting drupal ajax form

I am working on an existing site which has a Drupal 8 multi-step form which uses Ajax Upon submitting the form (on the final step) the page scrolls to the top where a thank you message has been ...
0
votes
0answers
32 views

Ajax implementation in exposed forms

We use to add property '#ajax' to a form element in our form array, to trigger an Ajax response and it works fine except in case of views exposed forms. This doesn't work in case of views exposed ...
0
votes
2answers
57 views

AJAX callback inside hook_form_alter()

I don't know how to implement AJAX callback in hook_form_alter(). The field is plain text by default and it is populated by NID (number) of the client company. The module name is "my_car". I didn't ...
0
votes
2answers
29 views

Ajax error render

I receive this error message when I try my custom form in Drupal 8. User error: "0" is an invalid render array key in Drupal\Core\Render\Element::children() This is the code I am using namespace ...
0
votes
1answer
31 views

Provide autocomplete field with user's Display Name

Drupal core already supports autocompletion of username fields. However is there a way to provide autocomplete for user's Display Name? Since this is a virtual field, a database query with % like ...
0
votes
0answers
23 views

form : I need to prepopulate an entity reference multi value field depending on select list

I need to prepopulate an entity refence field depending on a list selection field. If the user select liste "administrator" then ajax need to prepopulate the field with users asssociated to this list....
0
votes
1answer
18 views

How do I change the Views (Entity Reference) filter via AJAX?

I have an entity form that allows an admin to select a content type (checkbox) and an autocomplete field that is tapped into a VIEWS Entity Reference (via the Reference Method). Goal: What I would ...
0
votes
0answers
36 views

Ajax Issues with Drupal Layout Builder

We're trying to use the new Layout Builder to configure some of our content types. When we click the "add section" button under Manage Layout, we get the following errors: On the page in the console ...
0
votes
0answers
19 views

Private Message AJAX request is breaking theme by loading JavaScript code twice

I have a strange issue when using private message module together with the bootrap theme. I setup the block to select the conversation/thread on the left region. I noticed when I use this block ...
0
votes
1answer
43 views

How to get and apply current page query parameters from current AJAX request

I'm having a hard time figuring out how to do this. Essentially I have a table displaying users on a page. The table is paginated with the PagerExtender and sortable with the TableSortExtender. Each ...
2
votes
1answer
68 views

Calling a JS function after managed file has completed uploading

How can I call a JavaScript function after a file has completed uploading using the Drupal Form API (FAPI) managed_file element?
0
votes
1answer
48 views

Set and Get $form_state with ajax button submit function?

In my case, I need to get a list of config files to show in a form element. Extending from this Drupal Answers Q/A using form_state->set() inside ajax callback but cannot get the value back outside ...
0
votes
0answers
17 views

form field description tags stay after ajax rebuild

When i rebuild my page via ajax e.g. with a button that dynamically adds additional form fields, the description tags (tooltips) of the Bootstrap theme that were shown to the user in the moment of the ...
0
votes
0answers
10 views

AJAX rebuild single form element

I'm trying to get an AJAX-enabled form working. Users should be able to tab between fields using the keyboard, and when a user tabs to the next element, I want the name span after the previous-focused ...
1
vote
1answer
61 views

Manually trigger AJAX from custom JavaScript

I'm in the process of developing a form where the user enters a UK postcode and the textfield is replaced by a select list. This all works quite nicely when using the blur event, but it is not always ...
0
votes
0answers
39 views

Ajax on Gmap marker placing

I've got a geofield and an address field on my content type, there is a geocoder module which can hide geofield and set it's value based on the addressfield value when the entity is saved. what I ...
0
votes
0answers
24 views

Modal does not handle errors on login

I have used 'use-ajax' class to render login form in a modal. I want to handle validation errors on same modal without closing it. On successful login it is redirecting correctly, but when an error ...
0
votes
0answers
27 views

Setting to reduce cache_form for ajax calls

I have a D7 site with the following seetings: I have a module that is adding an multistep ajax form to many pages, let's say to 80% of my pages. The form is loaded with different data, but the ...
0
votes
0answers
12 views

Drupal form element AJAX calls only if it has changed

I have a form with AJAX-enabled textfields. I currently have it working such that when a textfield loses focus, its AJAX callback is called. $form['entry'][] = array( '#type' => 'textfield', '#...
0
votes
0answers
49 views

Return an Ajax Response from EventSubscriber?

I am trying to return an ajax response when a user logs in while the page is loading post-login. /#1 approach was attaching an ajax callback to the user login form submit with form_alter. However ...
1
vote
2answers
34 views

Prevent form regeneration when a callback function is called through ajax

Here is the code for the custom form with a field(field_B) that calls an function through ajax. The issue is that I want the function (MY_MODULE_XYZ_function()) to be executed only once, when the ...
0
votes
1answer
62 views

How can I add custom client-side validation to a Webform field using advanced custom properties?

The setup: I have a Drupal 8 form created manually, and I would like to recreate it using Webform module. So far, I have managed to recreate everything (required fields and submission handler), but ...
0
votes
0answers
19 views

Vertical Tabs: Wrapper problem

I have a form with several fieldsets and i am thinking about adding a vertical tabs form field to turn the current fieldset to vertical tabs but i use a lot of AJAX in the fieldsets. The AJAX elements ...
0
votes
0answers
36 views

Adding AJAX to an existing form element?

I am trying to Ajaxify a node form element (field_unterbringung). When the user changes the value of an entity reference field (unterbringung) the markup should change from "old markup" to "new markup"...
0
votes
0answers
18 views

AJAX select field - $form_state not saved

SOLVED (see comments) I have a form with a select field (where you can select a title of a novel). This select field automatically writes a the respective ISBN of the novel into a textfield when a ...
1
vote
0answers
31 views

Redirect Page on Change of Exposed Filter

We have an All Articles view that is added to the http://www.example.com/articles page that is supposed to display all pages where content type is Article. The content type has a taxonomy term, ...
0
votes
0answers
37 views

Inline Entity Form hook_alter causes Ajax error on 'Add another' button

I created the module to hide some fields in my Inline Entity form. Although it works I faced the problem. I need to add multiple custom content nodes with Inline Entity Form. When my field setting ...
0
votes
0answers
34 views

How do I send variable from JavaScript to server?

I have been stuck on this for many days now and I am not sure how to proceed. What I would like to ultimately achieve: Get current user location coords using location.js library that I have linked to ...