Package net.pricefx.formulaengine.forms
Interface FormActionApi
- All Superinterfaces:
FormInputBuilderApi
The
FormActionApi is exposed to form logics through the form binding
during the action phase.
This phase is triggered when a user changes the value of an input. The logic can react by updating other inputs (e.g., setting values, labels, read-only state), inserting new inputs, or modifying the layout.
Extends FormInputBuilderApi so that input builder methods (e.g. create*) are
available for creating inputs to pass to insertAfter(String, ContextParameter...).
- Since:
- 17.0 - Paloma
-
Method Summary
Modifier and TypeMethodDescriptioninsertAfter(String inputName, ContextParameter... inputsToAdd) Inserts one or more new input definitions after the specified existing input.Returns the name of the input that triggered the current form execution.updateInput(String inputName) Returns aFormChangeobject for the specified input, allowing modification of its properties such as value, label, read-only state, or validity.Methods inherited from interface FormInputBuilderApi
createAnyUserEntry, createBooleanUserEntry, createButtonEntry, createConfigurationWizardPopup, createCustomerEntry, createCustomerEntry, createCustomerGroupEntry, createCustomerGroupEntry, createCustomFormListPopup, createCustomFormPopup, createDashboardInputs, createDashboardPopup, createDateRangeUserEntry, createDateTimeUserEntry, createDateUserEntry, createDMField, createDMFields, createDmFilter, createDmFilterBuilder, createDmFilterBuilderMultiple, createDmQueryBuilder, createDmQueryBuilderDimOption, createDmQueryFilterBuilder, createDMSource, createFilterBuilder, createHiddenEntry, createInputMatrix, createIntegerUserEntry, createMultiTierEntryInputBuilder, createOptionEntry, createOptionsEntry, createParsableInputTypeFile, createProductEntry, createProductEntry, createProductGroupEntry, createProductGroupEntry, createQuoteType, createRadioEntry, createRangeSliderEntry, createRebateAgreement, createResultMatrixFilterBuilder, createSellerEntry, createSellerEntry, createSellerGroupEntry, createSellerGroupEntry, createSliderEntry, createStringUserEntry, createTextUserEntry, createTimeUserEntry, createTreeEntry, createUserEntry, createVLookup
-
Method Details
-
sourceInputName
String sourceInputName()Returns the name of the input that triggered the current form execution. This is typically the input whose value changed.Example:
if (form.sourceInputName() == "country") { form.updateInput("city").setValue(null) }- Returns:
- The name of the source input.
- Since:
- 17.0 - Paloma
-
updateInput
Returns aFormChangeobject for the specified input, allowing modification of its properties such as value, label, read-only state, or validity. If noFormChangeexists yet for the given input name, a new one is created. Subsequent calls with the same input name return the same instance.Example:
form.updateInput("total") .setValue(form.input.quantity * form.input.price) .setReadOnly(true)- Parameters:
inputName- The name of the input to update. Must not benull.- Returns:
- A
FormChangeinstance for the specified input. - Throws:
NullPointerException- ifinputNameisnull.- Since:
- 17.0 - Paloma
-
insertAfter
Inserts one or more new input definitions after the specified existing input. This allows dynamically adding inputs to the form duringactionmode execution. Multiple calls for the same input name accumulate the inputs to be inserted.Example:
def newInput = form.createStringUserEntry("notes") .setLabel("Notes") .buildFormInput() form.insertAfter("quantity", newInput)- Parameters:
inputName- The name of the existing input after which new inputs will be inserted. Must not benull.inputsToAdd- The input definitions to insert as ContextParameter instances.- Returns:
- A
FormChangeinstance for the specified input, with the new inputs queued for insertion. - Throws:
NullPointerException- ifinputNameisnull.- Since:
- 17.0 - Paloma
-