Hi @NateWr,
I am trying to create a checkbox in the following places: Quicksubmitform submissionsubmitstep3form, and FORM_TITLE_ABSTRACT.
The checkbox works great in the quicksubmitform and submissionsubmitstep3form. However the FORM_TITLE_ABSTRACT is a little bit different. I tried to use this post as a guide:
Here you are suggesting to use Form::config::before and schema::get::publication, which I did. The checkbox shows up and the value is correctly saved in the publication_settings table.
However, every time I uncheck the checkbox in FORM_TITLE_ABSTRACT it goes back to “checked” after I click save. I am not sure how to approach this issue, since the values are correctly saved but the checkbox is shown incorrectly. Do you have an idea what the problem might be? Am I missing another hook so it shows up unchecked if I uncheck it and save it?
I am using OJS version 3.3.0-3.
Code:
public function addtoForm($hookName, $form)
{
// Only modify the form title abstract.
if (!defined('FORM_TITLE_ABSTRACT') || $form->id !== FORM_TITLE_ABSTRACT) {
return;
}
// Don't do anything at the site-wide level, only dependent context/journal.
$request = Application::get()->getRequest();
$context = $request->getContext();
if (!$context) {
return;
}
// Add a field to the form.
$form->addField(new \PKP\components\forms\FieldText('ppn', [
'label' => __('plugins.generic.ppn.field.title'),
]));
// Add a field to the form.
$form->addField(new \PKP\components\forms\FieldText('customComment', [
'label' => __('plugins.generic.custom.comment.field.title'),
]));
$form->addField(new \PKP\components\forms\FieldOptions('nativePub', [
'label' => __('plugins.generic.isDigital.section.title'),
'options' => [
['label' => __('plugins.generic.digital.version.field.title')],
],
]));
return false;
}
Best,
Tina