Utilities
Some general utility functions can be found in BootstrapElementUtils
.
Selecting a form control
You can use the getFormControl()
function to select the first actual form control in a container or FormGroupElement
.
Changing control names
You can use prefixControlNames()
or replaceControlNamesPrefix()
functions to modify the names of one or multiple controls.
Prefix all control names in a form
FormViewElement form = new FormViewElement();
TextboxFormElement textbox = new TextboxFormElement();
textbox.setControlName( "textbox" );
form.add( textbox );
form.apply( BootstrapElementUtils.prefixControlNames( "custom.prefix" ) );
assertThat( textbox.getControlName() ).isEqualTo( "custom.prefix.textbox" );
See the separate guide on control name prefixing for more information.