Search code examples
javajenkinsjelly

ValidateButton to test all entries in a repeatable


  • I need to check validate a number of fields in one operation with a validateButton,
  • this has worked fine with multiple fields
  • I've recently introduced a repeatable section, containing multiple checkboxes
  • I'm easily able to address these by name in the save operation and get the true/false values
  • when I try to pass the same to the validateButton with the 'with' nothing changes in the formData that gets sent (despite referencing the new repeatable stuff)
  • I've tried adding a field declaration in the following places...
    • on the outer entry
    • on the repeatable itself
    • on the nested entry
    • on the checkbox itself

Thanks.


Solution

  • So turns out this isn't possible just using the the 'with' attribute of the f:validateButton, even when the repeated entry is bound to a field (either the repeatER or the repeatED component).

    I was eventually able to implement this using the f:invisibleEntry and some javascript functions (called on the onclick of my repeated checkboxes) to update the contents of the invisible fields. One can then use the 'with' attribute of f:validateButton to send the value of this hidden field.