Skip to content

Commit

Permalink
Merge pull request #19 from episerver/bugfix/MAR-1501-Still-highlight…
Browse files Browse the repository at this point in the history
…-the-field-although-user-input-valid-data

Remove highlight when field validate success
  • Loading branch information
Tson-optimizely authored Jun 10, 2022
2 parents eb87cf3 + 43bfaa9 commit 6f1fe18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"scripts": {
"build": "webpack --mode production",
"build:debug": "webpack --mode development"
"build:debug": "webpack --mode development",
"build:config:watch": "webpack --config webpack.config.js --mode development --watch"
},
"browserslist": {
"production": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ const ABTestingSettings = () => {
}
};

const hasValidDuration = (duration:number) => {
return isNumber(duration?.toString()) && (duration > 0 && duration <= 365)
}

const hasValidPercent = (percent:number) => {
return isNumber(percent?.toString()) && (percent > 0 && percent <= 100)
}

const cancel = () =>{
setABTestingSettingsModel(aBTestingSettingsModelOrg);
}
Expand All @@ -100,17 +108,17 @@ const ABTestingSettings = () => {
label={aBTestingSettingsModel.testDurationLabel}
value={aBTestingSettingsModel.testDuration?.toString()}
onChange={handleChange}
type="number"
name="testDuration"
invalid={!hasValidDuration(aBTestingSettingsModel.testDuration)}
/>
</CardContentArea>
<CardContentArea>
<TextField
label={aBTestingSettingsModel.participationPercentLabel}
value={aBTestingSettingsModel.participationPercent?.toString()}
onChange={handleChange}
type="number"
name="participationPercent"
invalid={!hasValidPercent(aBTestingSettingsModel.participationPercent)}
/>
</CardContentArea>
<CardContentArea>
Expand Down

0 comments on commit 6f1fe18

Please sign in to comment.