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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
btbell
Posts: 16
Joined: Tue Nov 06, 2012 1:19 pm

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:
Image

Can you guys point me in the right direction?

Thx!

-b

asmecher
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm
Contact:

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.

Regards,
Alec Smecher
Public Knowledge Project Team


Return to “OJS Technical Support”

Who is online

Users browsing this forum: No registered users and 3 guests