Plugin migration to OJS3

The problem is, whereas a simple

<form class="pkp_form" id="SomeId" method="post" action="" >
  <input class="button defaultButton" type="submit"   name="button_ed_process" value="Process" />
</form>

which was put on the page via the plugin, was sufficient
in ojs 2.4.8 to reliably test on the server side for a button press event via
PHP code like this

is_set($_POST['button_ed_press'])

now all attempts to populate an empty _POST array
were rendered fruitless—an empty string as action in the form above
simply does nothing. Entering anything else produces a error like

“Stage not specified”,

suggesting that not my plugin is responding to the press event.

Can anyone give me a hint on how to send and receive a button press event
in ojs 3?

Yours sincerely,
Lilit

Hi @lilush,

I’d recommend specifying the action URL explicitly – now that we’re using AJAX subrequests heavily, it’s less clear where the request will go than it may have been in OJS 2.x.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

sorry for the delay, but still no luck—I fear You need to be more specific. I tried to my best to undestand & follow Your advice with this approach:

<form class="pkp_form"  id="latex_processing_button" method="post"
     action="{url plugins.generic.latexProcessing.LaTeXProcessing  op="test_function"}" >
      <input type="submit" id="process_latex_button" value="Process" />
</form>

<script type="text/javascript">
    $(function() {       
      $("#latex_processing_button").pkpHandler("$.pkp.controllers.form.AjaxFormHandler");
    }); 
</script>

The button is hooked into the Copyediting page. I’d like to call the method LaTeXProcessing.test_function(), but the server replies with a 301 and a workflow stage required. What is missing here?

Thanks for Your time and patience answering me.

Kind regards,
Lilit Hakobyan

Hi @lilush,

Have a look at the translator plugin for an example, such as:

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you very much for your Answer.

Kind regards,
Lilit Hakobyan