You are viewing the PKP Support Forum | PKP Home Wiki

set Country in registration form to be required

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

set Country in registration form to be required

Postby btbell » Wed Dec 18, 2013 2:32 pm

I have a need to set the Country in the registration form to be a required field. I set the markup in register.tpl, and I used the FormValidatorCustom class in the RegistrationForm.inc.php,
Code: Select all
$this->addCheck(new FormValidatorCustom($this, 'country', 'required', 'user.register.form.countryRequired'));

but this isn't complete. I tried to track this down to within FormValidatorCustom class but I'm now lost. When I test the form, leaving the Country field unset, I get this error, so the error message is formatted incorrectly and when I then go to set the country, I still get the error as if it's not set:

Can you guys point me in the right direction?


Posts: 16
Joined: Tue Nov 06, 2012 1:19 pm

Re: set Country in registration form to be required

Postby asmecher » Wed Dec 18, 2013 4:50 pm

Hi Brian,

That should probably be a plain FormValidator, not a FormValidatorCustom; with FormValidatorCustom you need to specify a custom function to use when checking validation.

The user.register.form.countryRequired needs to map to a locale key in one of the locale files, e.g. locale/en_US/locale.xml. You'll see ##things.like.this## when there is no text found for the given locale key.

Alec Smecher
Public Knowledge Project Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests