Message Boards

custom form field and preconfigured validation

Uwe Peters, modified 3 Years ago.

custom form field and preconfigured validation

New Member Posts: 22 Join Date: 11/24/20 Recent Posts

Hello,

I have build my own custom form field for the forms builder. I have set the settings for my form field through an interface DDMFormFieldTypeSettings that extends DefaultDDMFormFieldTypeSettings. 

In liferay forms builder I can place my own form field and set in the validation for it in the properties tab of my custom formfield.

Is it possible to preconfigure the custom form field validation? 
I want to place my custom form field and then by default it should have these validation settings preconfigured:

  • the the validation toggleswitch should be true 
  • the selected 'If Input' dropdown option should be 'does not match'
  • the 'The value' input for regex should contain my custom regex string
  • the 'show error message' input should contain my custom errormessage string

I think I can do this in my DDMFormFieldTypeSettings class but I dont know how.

I am using Liferay CE 7.3.5ga6.
 

thumbnail
Fredi B, modified 3 Years ago.

RE: custom form field and preconfigured validation

Junior Member Posts: 69 Join Date: 4/1/20 Recent Posts

Sorry to say but you should not rely on forms with Liferay CE 7.3.5ga6 maybe not even with Liferay at all.

We also had a problem with Liferay Forms with this version and decided to not use Liferay for such form-hevy demands. https://liferay.dev/#/questions/development/7-3-5-ga6-formbuilder-desaster/

I was not able to find documentation or help for quite similar demands as you have and this forum is not really heavy frequented anymore after the "style update".

Cheers and Good Luck. 

Uwe Peters, modified 3 Years ago.

RE: custom form field and preconfigured validation

New Member Posts: 22 Join Date: 11/24/20 Recent Posts

Well I cant find this in the docs either. Thank you Fredi B but this doesnt give much hope.

Is there anybody else who is building own custom form fields who can help here? Or somebody who has some experience or helpful links?


I think this should not  be that difficult, but as I said I cant find any help for this specific thing online :(.

thumbnail
Russell Bohl, modified 3 Years ago.

RE: custom form field and preconfigured validation

Expert Posts: 291 Join Date: 2/13/13 Recent Posts

Hi Uwe, I asked this internally and there should be a way to do what you want via DDMFormFieldTypeSettings.

The bad news is that this isn't working as expected so there's more investigation needed into why, maybe a bug.

The good news is that you should still be able to do what you want. Create a *DDMFormFieldTemplateContextContributor for your custom field and try to set the custom validation values there, like in ValidationDDMFormFieldTemplateContextContributor.java.

 

Francisco Javier Rivera, modified 2 Years ago.

RE: custom form field and preconfigured validation

New Member Posts: 15 Join Date: 6/27/11 Recent Posts

Hello @Uwe,

did you manage to do this in 7.3? I am having problems creating a form field with settings in Liferay 7.3.6 GA7, do you have a code that you can share that works?

Thank you.