admin管理员组

文章数量:1134240

I am building a legacy widget where I need to access some checkbox values added to the DOM in runtime using client script. For example:

<input id="groups-2-523221" type="checkbox" value="523221" name="groups[]" />
<input id="groups-2-303393" type="checkbox" value="303393" name="groups[]" />

This is how it looks like:

In classic widget editor mode, I can grab the values successfully by iterating through the $_POST['groups'] array. However, $_POST['groups'] is inaccessible when placing the widget in the block widget editor.

I can understand that the reason is that form is not being "posted" physically. But I am unable to find a solution. What is the best way to accomplish this?

本文标签: widgetsPOST variable is inaccessible in block editor Is there any workaround