Skip to content

Commit

Permalink
fix: validation for fields contains dash in id
Browse files Browse the repository at this point in the history
  • Loading branch information
tanftw committed Jan 8, 2025
1 parent 872dbd0 commit 523b65d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions js/validation/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
* group[1][subgroup][1][field][1][] => field // Cloneable group with cloneable subgroup with cloneable fields with multiple values: file, checkbox list, etc.
*/
const getValidationKey = name => {
// For fields without [], early return the name.
if ( name.at( '-1' ) !== ']' ) {
return name;
}

// Detect name parts in format of anything[] or anything[1].
let parts = name.match( /^(.+?)(?:\[\d+\]|(?:\[\]))?$/ );

Expand Down

0 comments on commit 523b65d

Please sign in to comment.