diff --git a/relog-web/src/DictInputRow.js b/relog-web/src/DictInputRow.js index 5ce6973..00f84a0 100644 --- a/relog-web/src/DictInputRow.js +++ b/relog-web/src/DictInputRow.js @@ -1,11 +1,11 @@ -import { useState } from 'react'; import form_styles from './Form.module.css'; import Button from './Button'; +import { validate } from './Form'; const DictInputRow = (props) => { const dict = { ...props.value }; if (!props.disableKeys) { - dict[""] = ""; + dict[""] = "0"; } let unit = ""; @@ -36,6 +36,15 @@ const DictInputRow = (props) => { if (index > 0) { label = ""; } + + let isValid = true; + if (props.validate !== undefined) { + isValid = validate(props.validate, dict[key]); + } + + let className = ""; + if (!isValid) className = form_styles.invalid; + form.push(
@@ -52,6 +61,7 @@ const DictInputRow = (props) => { data-index={index} value={dict[key]} placeholder={props.valuePlaceholder} + className={className} onChange={e => onChangeValue(key, e.target.value)} /> {tooltip} diff --git a/relog-web/src/FileInputRow.js b/relog-web/src/FileInputRow.js index 71239a9..a2b0099 100644 --- a/relog-web/src/FileInputRow.js +++ b/relog-web/src/FileInputRow.js @@ -2,7 +2,6 @@ import form_styles from './Form.module.css'; import Button from './Button'; const FileInputRow = (props) => { - let tooltip = ""; if (props.tooltip != undefined) { tooltip =