Create reusable SAIL component with validation rules passed as parameters

Hello all,

I have a use case that requires the development of a reusable SAIL component that is based on a!textField() component for displaying/saving decimal numbers as formatted text.

Apart from the need to customize the displayed text format of a decimal number, I need to save back to the decimal number the new text value converted to a decimal number IF it is a valid decimal number (which will be the base validation of this reusable SAIL component) along with any extra validations that should be passed into this SAIL component as these validations may vary from application to application.

Any ideas?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    Have a rule input of type Text Array defined in the reusable component rule (let's call it 'validations') which will allow input validations from the wrapper rules. In addition to this, you can also define your base validation rule inside the reusable component. Your text field will look something like this:
    a!textField(
    .......
    validations: {
    rule!YOUR_BASE_VALIDATION_RULE(),
    ri!validations
    }
    .....
    )
Reply
  • 0
    Certified Lead Developer
    Have a rule input of type Text Array defined in the reusable component rule (let's call it 'validations') which will allow input validations from the wrapper rules. In addition to this, you can also define your base validation rule inside the reusable component. Your text field will look something like this:
    a!textField(
    .......
    validations: {
    rule!YOUR_BASE_VALIDATION_RULE(),
    ri!validations
    }
    .....
    )
Children
No Data