Questions tagged [ajax]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
855 views

form_set_error() redirects to raw ajax response page

I have a page with a simple view. Above the view there is a menu link that when clicked loads a node form with a required file field. The form is fetched and loaded using ajax_commands into a div on ...
0
votes
1answer
2k views

reCaptcha does not display on modal window(colorbox) webform

I have a webform that I want to add a reCaptcha to. So far I've done everything properly, the webform will display a recaptcha box below the form when viewing the node form. I have a modal window ...
3
votes
3answers
1k views

Dynamically add input field using #ajax

As the question says, im not clear on how to go about adding new input fields depending on values of certain fields in the form. I got as far as setting a callback and a wrapper, but i just can't ...
1
vote
1answer
417 views

Override Ajax throbber icon styles

I've been digging around the CSS and JS files but I haven't quite found the exact thing that places the throbber.gif where it appears when clicking on 'previous' or 'next'. The styling is in system....
0
votes
1answer
2k views

Multiple checkboxes in an AJAX calls

I've been developing this phonegap app and I'm stuck with a few things and one of them is multiple checkboxes - I hope you can help. I've got the below code HTML <input type="date" id="date" /&...
1
vote
1answer
1k views

AJAX Populated Views Exposed Filter

I'm re-building a travel website and need the trip search form to have the "Arrivals" select populated using AJAX once the departures has been selected to remove any empty search results. I have ...
2
votes
2answers
1k views

How to validate file is selected or not on ajax processed jquery validation

I am trying to do jquery validation on file upload for file is select or not. I want when user click on upload before submit check file is selected or not. if not stop ajax request. Any Idea to ...
1
vote
1answer
1k views

Ajax callback on select box change event not working on second time

I am building a form with form API in a custom module. Certain fields should be populated based on the selected value of a dropdown. User will select the pre-entered profiles, based on which other ...
1
vote
3answers
2k views

Dynamic select lists (dependent dropdowns)

I created 2 dependent dropdowns in Drupal 7. In the first dropdown you need to choose the device, in order to see its attributes in the second dropdown. When an option from the first list is ...
2
votes
1answer
113 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, ...
2
votes
1answer
1k views

How do I attach AJAX click events on <button> or <div> tags?

There are many examples how to make ajax form submits and also many examples how to make drupal ajax links. How do I attach AJAX click events on, for example, <button> or <div> tags?
2
votes
1answer
1k views

Upload a file by Ajax without submitting the form

I want to upload a file by Ajax (without submitting the form) than process in backend, and clear the field to allow to add another file. Is it possible with Drupal 8? Can anyone provide an example? I ...
2
votes
2answers
910 views

Can't get Ajax data sent to my PHP function

I recently took over an existing Drupal project and I tried to add a new PHP function (which works regularly) and link it with an Ajax query. There were already some in place that worked, and I wanted ...
0
votes
1answer
359 views

Can't update radio button fields after ajax callback

I'm having troubles with a FORM in Drupal 8, the idea is: Chose a radio value from radio-estaciones to recharge radio-contaminantes, but, after the callback, the result I see is empty, but in replace ...
0
votes
2answers
474 views

How to disable a file upload button for anonymous users?

I've created a commerce add to cart form with a file upload field. The user can use this to upload a logo but I don't want anonymous users to be able to do this. I can see that the file module uses ...
4
votes
2answers
4k views

How to trigger a form and pass variables to $form_state with jQuery?

What is the way to trigger a Drupal form via JavaScript, and pass new values to $form_state while doing so? I have a main form, which has an element that triggers a jQuery UI dialog with a form in it. ...
2
votes
2answers
1k views

Ajaxly set Text Field Value with Drupal Forms API

I have a text field and a ajaxified link in my form: $form['id_number'] = array( '#title' => t('ID Number'), '#type' => 'textfield', //textfield '#suffix' => '<div>l(t('...
1
vote
2answers
729 views

Value from ajaxified form field not passed to ajax callback

This is a continuation of this issue, where I couldn't get the ajax to fire on an entity reference field in a node edit form. With the following code, I'm able to get the ajax to fire. /** * ...
1
vote
2answers
385 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 ...
2
votes
1answer
33 views

Custom AJAX Response not firing on Flag action

I'm trying to run custom javascript functions at the same time as people interact with certain flags on my site, I have followed this tutorial on how to respond to both Flag/Unflag actions, and this ...
5
votes
1answer
1k views

Using the Batch API with AJAX?

I have been trying to figure out how to use the Batch API in an overlay via AJAX, but are not sure that's possible at all? - As far as I can see the batch API, when javascript is enabled, calls the ...
2
votes
2answers
648 views

Update price via AJAX

I created a content type (main prod) that is referencing a product content type (sub prod). The sub prod is also referencing another product content type called (option sets) which will be the option ...
0
votes
2answers
605 views

Querystring in Views ajax_view.js

I'm using Views 7.x-3.11 with Better Exposed Filters and Ajax auto-submit in a panels page, and running into some issues that seem to be stemming from code in Views/js/ajax_view.js. I want to make the ...
1
vote
1answer
346 views

Checking Available Update data - AJAX error

I'm having problems with a local site that I imported to Acquia Dev desktop from one of my live sites. Everytime I try to Check for Available Update data, I get an Ajax error Error Checking Update ...
1
vote
1answer
463 views

Adding value to multi-delta textfield programmatically

I have a phone field in a form, which is just a textfield with its default widget. I'm trying (and failing) to add values to this field programmatically through ajax calls. I have an ajax call ...
0
votes
2answers
448 views

Ajax Form Not Working in some Some Regions

I created an ajax based contact form in my module.Then I made a block view for the form. I tried putting that block to several regions. When I put the block to 'Sidebar Second' the form works as ...
1
vote
2answers
988 views

form_get_errors() is NULL when calling it in an AJAX form callback

I have a form with a bunch of required fields that all have the same callback. Here's a single field example: $form['name'] = array( '#type' => 'textfield', '#title' => t('Name'), '#...
1
vote
2answers
352 views

Ordering results for form autocomplete fields

I've done the cursory googling, but so far I haven't found anything close to an answer for this. I'm using the Masquerade module with a custom module on top to extend it and make its searching ...
0
votes
1answer
996 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
1answer
1k views

Trigger ajax callback from input field webform

I have a form build with the webform module. When text is entered in the input box in this case webform component 2 I want it to execute a ajax function and put data in a div. However this is not ...
2
votes
1answer
1k views

problem using ajax callback in form

I have a very simple form that has a select box of the terms in a vocabulary, and renders the selected term below it. It seems that the first time I change the value in the select it renders the ...
4
votes
1answer
2k views

The modal doesn't appear

I want to output a link in a modal window, using the Simple Link approach shown on Make Mine a Modal. When the link is clicked, the little animated spinner appears, and I can see the response returned ...
1
vote
1answer
583 views

Trigger AJAX from a Google Maps Marker

I have a Google map loaded through the Google Maps API with markers generated from node locations. How can I cause content to be loaded via AJAX when one of the markers is clicked. For example, if ...
4
votes
2answers
14k views

How can I get the form validated with AJAX?

I'm building pretty simple forms loaded with AJAX and displayed with Foundation Reveal. I can get the form submission to work with AJAX, and update the markup inside the reveal, but with the AJAX-...
0
votes
1answer
922 views

ajaxify content via a callback function

I am trying to ajaxify my site. I want the "Main page content" to be passed via an ajax-command to a custom js-function. To accomplish this I would do the following: I need to register a path for ...
0
votes
1answer
718 views

I cannot upload an image - 404 ajax error

When I try to upload an image, image is not generating and I always get ajax error. I cannot upload an image. I get a 404 ajax error. I use Drupal 8.54 php.ini: memory_limit = 254M ...
-1
votes
1answer
25 views

Set the quantity per product equal to value in input

I'm using the Commerce Ajax Add to Cart module to add a product to my cart using AJAX. I guess I'll have to do that by creating a patch. It's working fine, but I'd like to change how a product is ...
0
votes
1answer
1k views

Autofill texfields based on select option in dynamic fieldset

In my custom form i am dynamically generating multiple fieldsets.Each field set has select option(dropdownlist) and textfield generated dynamically. The value for textfield is dynamically generated ...
1
vote
0answers
24 views

How to reload flagging form via ajax?

My task is to ajaxify complex flag form (with additional fields). I need this because the default ajax flag does not dupport fiedls. I need to have the flagging form for create flag and then update it ...
4
votes
2answers
2k views

Load an AJAX submission enabled webform using another AJAX call

I am using Javascript/AJAX to call a path defined in a custom module which loads existing node content for display. i.e. you are at: /custom/path and it makes an AJAX request to /custom/content ...
7
votes
1answer
601 views

What is the use of Drupal.settings.ajaxPageState object?

I am working on a Drupal site on which a functionality breaks because the value of Drupal.settings.ajaxPageState.js gets reset to an empty array instead of an object containing the list of js files. ...
1
vote
1answer
658 views

How to execute ajax action after image file upload with media widget?

I want to prepopulate some node fields with image metadata (using the EXIF module) right after an image is uploaded/inserted in a node image field with media browser widget and before the node is ...
0
votes
1answer
825 views

ajax update block on click to link

I am using jQuery Ajax Load module in my site to load some contents from url to show on specific div which has a required class. With this module I am able to fetch the Page content from URL through ...
0
votes
2answers
1k views

An AJAX HTTP request abnormally terminated in autocomplete textbox

I have autocomplete textbox which populate the suggestion based on search text. Steps User type in search text box User press enter instead of waiting for AJAX autocomplete to respond It comes up ...
1
vote
1answer
683 views

Update commerce cart block when product added through ajax

Hii How can I update commerce_cart_block when my product is added through ajax. Any suggestion will be helpfull.
1
vote
2answers
91 views

How do I add <tr> tag in a table using ajax_command_replace()?

I am using ajax_command_replace() in an AJAX callback. It works fine to remove the full <table> markup, but I only need to add a row to the table after a form is submitted, when data exist. What ...
0
votes
1answer
16 views

Node form ajax dependent dropdown fields issue

I am using Drupal 9. I know how to change single dropdown list using another one. Here is my scenario: I have three dropdowns, in node form - company, protocol and investigator. What I like to do, ...
1
vote
2answers
366 views

alter Suggestion box for apache solr autosearch

I want to restrict the suggestions for Apache Solr Search with hook_apachesolr_suggestions_alter(&$suggestions, $env_id). I have gone through the code and found the suggestion is prompt from ...
0
votes
1answer
614 views

How to use 'use-ajax' class with pages created by controller?

I'm trying to use 'use-ajax' class to load a page inside a modal box. My Page is dynamically created using node id pass on my page controller My link looks like this Any idea on how can I achieve ...
0
votes
0answers
58 views

How do I prevent a block from being loaded via Big Pipe

I have a view block, nothing crazy, just a couple fields. I want to present it as a carousel. Everything worked fine, until suddenly Drupal decided to start loading the block asynchronously with Big ...

1
2 3 4 5
50