8 – Ajax enabled form stopped working – Ajax callback never called

I have the weird problem that an Ajax enabled form that just worked stopped working – and I have not a clue what is causing this and when it stopped to work. The form itself has no changes for months now and I did not find any code updates which may interfere with this form.

The form is defined in its own form class which extends FormBase. The Ajax functionality is added with the following code in buildForm() method:

$form('form_container')('actions')('submit') = (
  '#type' => 'submit',
  '#value' => 'Submit',
  '#ajax' => (
    'callback' => '::ajaxResponse'
  ),
  '#attributes' => (
    'class' => ('js-show-throbber')
  ),
  '#weight' => -45,
);

In the form class the method is defined:

public function ajaxResponse(array $form, FormStateInterface $form_state)

When I set a breakpoint within this method for XDebug the script never stops, the process within this methods are not running.

There is no info in browser’s console, it is not working in any browser and in watchdog of Drupal are no entries. For me it seems that somehow the bridge between browser / JavaScript world and the form PHP class is broken. I use the exact same PHP code for many other forms without any problem.

My question: can anybody give me a hint how exactly the bridge between browser and form class is created when the form gets rendered? How can I find out if there is a problem in the PHP form class or somewhere in JavaScript?

WordPress plugin called “YITH WooCommerce Questions and Answers Premium”, Its data is not showing in REST API’s


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




etymology – Why are “fields” are called that?

Those textboxes, datepickers, textareas, etc… or DB fields.
Does anyone know the etymology of it? Why those are “fields”? Is it because a field is an open space area that has no trees growing on it thus representing a textbox with no data in it? I can get why a mouse controller is called this way – it looks like a mouse. But what about fields? In other languages a word with the same meaning is used, but I believe it’s been borrowed from English.

windows – MongoDB Compass GUI: Error importing: Callback called multiple times

I am completely new to MongoDB. Just downloaded and installed MongoDB Community Edition on my local Windows pc. The MongoDB Service is running, and I was able to connect to this local cluster. I have created a collection, and am trying to use the Compass GUI to import a JSON-File, which I have verified to contain valid JSON.

When I choose Add Data => Import File

enter image description here

and select the file I want, I get the following error:

Error importing: Callback called multiple times

enter image description here

If, instead of chosing Import File, I chose Insert Document

enter image description here

and manually paste the entire file contents into the following dialog, the document is succesfully added to the Database.

I’d like to import multiple documents/files at once, so manually copy-pasting each one isn’t really an option. Why would I be getting this error?

Error importing: Callback called multiple times

unity – Method subscribed to an event is called twice for every time the event is raised

I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this:

-An InventoryObject is defined as having a “Container” List of ItemObjects (simple scriptable objects, they just have a little information on the object as its sprite, its name, and whether or not it is stackable) and some methods to properly add or remove items (taking item stacking into account) from that list. https://pastebin.com/t4P3aGmi

-A PlayerInventory is a script that will be carried by the player’s character. It contains a method for adding items collided with to its assigned InventoryObject instance. It also contains an OnItemPickedUp event that takes its InventoryObject instance as a parameter and passes it to listeners like UpdateDisplay. OnItemPickedUp is raised whenever a collision with a compatible item happens. https://pastebin.com/RsV7XYPp

-An UpdateDisplay script that listens to the OnItemPickedUp event and subscribes the
ProcessInventoryToSingleString(InventoryObject _inventory) method, that subsequently calls several methods to transform the contents of the InventoryObject’s Container list into a single, formatted string. https://pastebin.com/N0nsvcWH

-The items are represented by giving a GameObject with a collider2D, aSpriteRenderer and script that contains the particular ItemObject’s data and sets its SpriteRenderer’s sprite to the ItemObject’s.

The problem I’m having is that the method subscribed to the event is being called more than once for each time the event is raised. as shown by the debug logs. Sometimes it’s called twice, sometimes even four. This results in my UI display showing more items than there are.
https://files.catbox.moe/afa467.mp4

Here are pictures of the console debug logs:
I'd copypaste the debug logs, but I can't do that in one go.

I appreciate any help.

iis – Website works remotely but not on the server itself when called by domain

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: “localhost” and “mydomain.com” on port 80.

mydomain.com works correctly from any client but on the server only when I call “localhost” it works otherwise I get the following error (when called by domain):

enter image description here

iis – Website works remotely but not on the server itself when called by domain

I am using Windows Server 2019 and in IIS 10 I have created a website and I have bound it to both: “localhost” and “mydomain.com” on port 80.

mydomain.com works correctly from any client but on the server only when I call “localhost” it works otherwise I get the following error (when called by domain):

enter image description here

php – Ajax result show in console if is called outside function and not showing in array

In wordpress theme I must change custom functionality and use ajax, so I have dropdown and on change I grab selected option:

JS

$( ".select-class" ).change(function(e) {

    var postofficeval = $(this).val();
    $.ajax({
        method: "POST",
        url: ajaxurl,
        //url: "urltophpfile.php", 
        //action: "postnum_ajax",
        data: {"post_office": postofficeval }
        //data: {ajaxselectedcode: $(this).val()}
      })
        .done(function( msg ) {
          console.log( "Data Saved: " + msg );
        });
}); 

In console I see:

Data Saved: Array
(
(post_office) => 3330
)

if I print this in php I get empty array:

print_r($_POST) 
and If I try with var:
$postalnum = $_POST('post_office') 

which I need to manipulate showing data in future also not working.

Also if I uncomment action and add

print_r($_POST) in:

function postnum_ajax() {

    // if ( isset($_POST) ) {
    //  $postalnum = $_POST('post_office');

    // }

    print_r($_POST);
   

   die();
}

add_action( 'wp_ajax_postnum_ajax', 'postnum_ajax' );
add_action( 'wp_ajax_nopriv_postnum_ajax', 'postnum_ajax' );

Can anyone help me please? I need this selected post_num to manipulate in php which content is showing.

Thanks for help,

Can i play the game called BADLAND on my tv with 2 bluetooth controllers

I am going buy 2 wireless controllers by GSH and they are the so-called best on youtube , so can I play BADLAND Co-op with both,cause I tried on remote ,I cant choose other colours, so I click Co-op and I cannot go to the other options like the keys dont WORK, HELP

Need help summing a row of words that have a value called out in a seperate table on the sheet

This should be easy, but Im struggling to find the way to do this…I have a row that contains operations..lets say a1 is laser, b2 is weld, c1 is mill, and d1 is paint. I have a seperate table on the sheet that says what these operations equal. m1 is laser & n1 is a value of 1. m2 is mill & n2 is a value of 3…and so on. At the end of the row with the operations, say e1, I want to calculate each operations value based on the table. How can I accomplish this?