Is it possible to put affiliation as mandatory for contributors/authors?
Thanks
Is it possible to put affiliation as mandatory for contributors/authors?
Thanks
Hi @vvucic,
Thatâll require a modification for the moment. We frequently get requests for various fields to be made optional if theyâre required, or required if theyâre optional, and weâre not going to make everyone happy on that â we may add flags to control the required status of these fields, but I canât promise that just yet.
Regards,
Alec Smecher
Public Knowledge Project Team
I will be happy if I will be instructed which file to modify in order to get that done. I understand that it is time consuming to make everyone happy.
Thanks
Hi @vvucic,
The form responsible for the author form is implemented in lib/pkp//pkp/controllers/grid/users/author/form/AuthorForm.inc.php
, and the corresponding template is lib/pkp/templates/controllers/grid/users/author/form/authorForm.tpl
. Have a look at the existing fields as an example of how to require additional ones.
Regards,
Alec Smecher
Public Knowledge Project Team
I added line in lib/pkp//pkp/controllers/grid/users/author/form/AuthorForm.inc.php
$this->addCheck(new FormValidator($this, âaffiliationâ, ârequiredâ, âform.affiliationRequiredâ));
and in lib/pkp/templates/controllers/grid/users/author/form/authorForm.tpl
I added line affiliationRequired=true
after countryRequired=true
But I still do not have affiliation marked as mandatory.
Please advise.
Thanks
Hi @vvucic,
Youâll also need to add support for the affiliationRequired
flag to lib/pkp/templates/common/userDetails.tpl
as well.
Regards,
Alec Smecher
Public Knowledge Project Team
Just got it
see screenshot
Is it possible for me to indicate the code that I should include in lib/pkp/templates/common/userDetails.tpl to add support for the affiliationRequired?
I have included the modified code presented by @vvucic in lib/pkp//pkp/controllers/grid/users/author/form/AuthorForm.inc.php, and the corresponding template is lib/pkp/templates/controllers/grid/users/author/form/authorForm.tpl
But Iâm not sure how to continue ⊠What is the code required in lib/pkp/templates/common/userDetails.tpl to make the data mandatory âaffiliationâ.
I also thank @astevens for his great help and good response on this subject in:
Thank you very much!
I can send you tpl files that I edited. OK?
Hi @asmecher,
I am wandering if there is a way to make an attribute mandatory for several languages? That means in a journal that uses two languages that an attribute has to be specified in both languages, not just the primary one.
Best regards, PrimoĆŸ
This is how file userDetails.tpl looks in my installation in which I set that affiliation is mandatory.
The rest is related to procedure that I described. here it is again:
I added line in lib/pkp//pkp/controllers/grid/users/author/form/AuthorForm.inc.php
$this->addCheck(new FormValidator($this, âaffiliationâ, ârequiredâ, âform.affiliationRequiredâ));
and in lib/pkp/templates/controllers/grid/users/author/form/authorForm.tpl
I added line affiliationRequired=true
after countryRequired=true
Please describe in more details what you want to accomplish. Please try to describe concrete scenario/situation.
Thanks
Hi @vvucic
Concrete example, easy: Imagine you have a journal that supports English and Slovene languages, English as a primary. I would like to make mandatory that a submitter provides an issue title in both languages, English and Slovene. And similar to other metadata (keywords, abstract,âŠ).
Best regards, PrimoĆŸ
In OJS 3.1 you can choose which metadata fields are mandatory. Please check that.
Hi⊠@vvucic⊠thanks⊠You can me the TPL to my email is davidyoriana@gmail.comâŠ
Thanks for help me!
The content is in pastebin link I put above. If you cannot find it I will paste it again.
@vvucicâŠ
Thanks!!!
Hi @vvucic, @asmecher,
I would like to make âaffiliationâ and âbiographyâ a ârequiredâ field in âarticle contributorsâ form.
I have made changes as described above in all three files:
$this->addCheck(new FormValidator($this, 'affiliation', 'required', 'form.affiliationRequired'));
$this->addCheck(new FormValidator($this, 'biography', 'required', 'form.biographyRequired'));
affiliationRequired=true
biographyRequired=true
a. {if $affiliationRequired}
{assign var="affiliationRequired" value=true}
{else}
{assign var="affiliationRequired" value=false}
{/if}
{if $biographyRequired}
{assign var="biographyRequired" value=true}
{else}
{assign var="biographyRequired" value=false}
{/if}
and
b. (only the bold codes below)
{fbvFormSection for=âaffiliationâ}
{fbvElement type=âtextâ label=âuser.affiliationâ multilingual=âtrueâ name=âaffiliationâ id=âaffiliationâ required=$affiliationRequired value=$affiliation inline=true size=$fbvStyles.size.LARGE}
{/fbvFormSection}
{fbvFormSection}
{fbvElement type=âtextareaâ label=âuser.biographyâ multilingual=âtrueâ name=âbiographyâ id=âbiographyâ required=$biographyRequired rich=true value=$biography}
{/fbvFormSection}
Now, in the user form, I get both the fields as ârequiredâ
But, only the affiliation field behaves as âtruly requiredâ. If I leave it empty and try to save the form, it shows the error and get stuck to the field.
However, in case of biography, even if I leave it blank and save the form, its throws and message âthe field is requiredâ immediately saves it successfully.
What am I missing here?
Best regards,
Hi @anupent,
Youâll need to use FormValidatorLocale
for localized fields.
Regards,
Alec Smecher
Public Knowledge Project Team
Thank you @asmecher,
Its working now.
best regards,