Fórum

change a field to be required

ima ima, modificado 11 Anos atrás.

change a field to be required

New Member Postagens: 10 Data de Entrada: 29/07/12 Postagens Recentes
Hi all
I have to mark some of the fields required for exemple "legalId" ,in the setting page, is a optionnal field so I want to change it to a required one.Is there a way to do it?
Thank you
thumbnail
Hitoshi Ozawa, modificado 11 Anos atrás.

RE: change a field to be required

Liferay Legend Postagens: 7942 Data de Entrada: 24/03/10 Postagens Recentes
Is this your custom portlet? Can't you just use Validator to make the field required?
ima ima, modificado 11 Anos atrás.

RE: change a field to be required

New Member Postagens: 10 Data de Entrada: 29/07/12 Postagens Recentes
actually I use Validator to make it required. this is what I did

I utilise ext plugin to override the CompanyLocalServiceImpl class so I add this action


protected void validatee(String name) throws PortalException {
if (Validator.isNull(name)) {
throw new LegalIdException();
}
}


I also override the EditCompanyAction (I add the exception to be catched )
.........
............
else if (e instanceof AddressCityException ||
e instanceof AccountNameException ||
e instanceof LegalIdException ||
e instanceof AddressStreetException ||
e instanceof AddressZipException ||
e instanceof CompanyMxException ||
e instanceof CompanyVirtualHostException ||
e instanceof CompanyWebIdException ||
e instanceof EmailAddressException ||
e instanceof NoSuchCountryException ||
e instanceof NoSuchListTypeException ||
e instanceof NoSuchRegionException ||
e instanceof PhoneNumberException ||
e instanceof WebsiteURLException) {

But it does not catch the exception ???