Message Boards
custom form field and preconfigured validation
custom form field and preconfigured validation
New Member Posts: 22 Join Date: 11/24/20 Recent PostsHello,
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.
RE: custom form field and preconfigured validation
Junior Member Posts: 69 Join Date: 4/1/20 Recent PostsSorry 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.
RE: custom form field and preconfigured validation
New Member Posts: 22 Join Date: 11/24/20 Recent PostsWell 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 :(.
RE: custom form field and preconfigured validation
Expert Posts: 291 Join Date: 2/13/13 Recent PostsHi 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.
RE: custom form field and preconfigured validation
New Member Posts: 15 Join Date: 6/27/11 Recent PostsHello @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.