Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
ima ima
change a field to be required
31 de Julho de 2012 16:24
Resposta

ima ima

Ranking: New Member

Mensagens: 10

Data de entrada: 29 de Julho de 2012

Mensagens 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
Hitoshi Ozawa
RE: change a field to be required
31 de Julho de 2012 16:46
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 7949

Data de entrada: 23 de Março de 2010

Mensagens recentes

Is this your custom portlet? Can't you just use Validator to make the field required?
ima ima
RE: change a field to be required
2 de Agosto de 2012 07:24
Resposta

ima ima

Ranking: New Member

Mensagens: 10

Data de entrada: 29 de Julho de 2012

Mensagens 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 ???