AEM 6.2 Forms Hide Button until all mandatory fields are filled

radzmar

MVP

28-11-2017

Hi,

I recently started using AEM Forms 6.2 for developing adaptive forms and I'm a bit lost. How can I control the visibility of a button in the way, that it will be invisible until every mandatory field has been filled? I know I can use the visual editor to add such rules, but this solution is very cumbersome, as I would have to modify it permanently when adding or removing fields. I'm looking for a more comfortable solution, like a JavaScript that will permanentely check all those mandatory fields. Any ideas about this?

View Entire Topic

deepak_k_

Employee

29-11-2017

You can write a common API which is execute on valueCommit and does this.parent.validate([]). And if that returns true, enable the button else skip that.

Alternate would be to listen to guideBridge event called elementValueChanged which wraps the field object in the event payload. And you could call the similar(as above) API and make the button visible/hidden.

Unfortunately, I don't have snippet available, but git it a shot.