Skip to content

Commit

Permalink
update rename field function in group.js for change the dependson val…
Browse files Browse the repository at this point in the history
…ue when use dependent multiselect options
  • Loading branch information
parth-ka-patel committed Aug 8, 2023
1 parent 056db7f commit f4d03df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

14 changes: 6 additions & 8 deletions resources/js/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,14 @@ export default class Group {
* Assign a new unique field name to each field
*/
renameFields() {
for (var i = this.fields.length - 1; i >= 0; i--) {
let newAttribute = [];
for (var i = 0; i < this.fields.length; i++) {
newAttribute[this.fields[i].attribute] = this.key + '__' + this.fields[i].attribute;
if (this.fields[i].dependsOn !== undefined) {
this.fields[i].dependsOn = newAttribute[this.fields[i].dependsOn];
}
this.fields[i].attribute = this.key + '__' + this.fields[i].attribute;
this.fields[i].validationKey = this.fields[i].attribute;

if (this.fields[i].dependsOn) {
Object.keys(this.fields[i].dependsOn).forEach(key => {
this.fields[i].dependsOn[`${this.key}__${key}`] = this.fields[i].dependsOn[key];
delete this.fields[i].dependsOn[key];
});
}
}
}

Expand Down

0 comments on commit f4d03df

Please sign in to comment.