mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-28 00:20:48 +00:00
use for loop instead of forEach
This commit is contained in:
parent
bed8f93d7c
commit
2157e3ef8c
1 changed files with 10 additions and 10 deletions
|
|
@ -442,20 +442,20 @@ export default {
|
|||
|
||||
const inputValues = {};
|
||||
|
||||
inputs.forEach(input => {
|
||||
if (input.type === 'radio' || input.type === 'checkbox') {
|
||||
for(const input of inputs){
|
||||
if(input.type === 'radio' || input.type === 'checkbox'){
|
||||
// Only add if the input is checked
|
||||
if (input.checked) {
|
||||
if(input.checked){
|
||||
inputValues[input.name] = input.value;
|
||||
}
|
||||
} else {
|
||||
// For other input types, just get the value
|
||||
inputValues[input.name || input.id || input.type] = input.value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fieldData = inputValues;
|
||||
} else if (options !== null && options !== "") {
|
||||
} else if(options !== null && options !== "") {
|
||||
useCache = false;
|
||||
// split options into an array of names
|
||||
const validNames = options.split('|');
|
||||
|
|
@ -466,11 +466,11 @@ export default {
|
|||
const inputValues = {};
|
||||
|
||||
// Filter inputs by name and handle their values
|
||||
inputs.forEach(input => {
|
||||
if (validNames.includes(input.name)) {
|
||||
if (input.type === 'radio' || input.type === 'checkbox') {
|
||||
for(const input of inputs){
|
||||
if(validNames.includes(input.name)){
|
||||
if(input.type === 'radio' || input.type === 'checkbox'){
|
||||
// Only add if the input is checked
|
||||
if (input.checked) {
|
||||
if(input.checked){
|
||||
inputValues[input.name] = input.value;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -478,7 +478,7 @@ export default {
|
|||
inputValues[input.name] = input.value;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fieldData = inputValues;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue