Affiliation mandatory, OJS 3.0.1.0

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:

  1. In AuthorForm,inc.php, I added
$this->addCheck(new FormValidator($this, 'affiliation', 'required', 'form.affiliationRequired'));
$this->addCheck(new FormValidator($this, 'biography', 'required', 'form.biographyRequired'));
  1. In AuthorForm.tpl, I added
affiliationRequired=true
biographyRequired=true
  1. In UserDetails.tpl, I added codes at two places:
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”
image

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,

1 Like