Skip to content

Commit

Permalink
Fix RequiredValidator works incorrectly with blank space value
Browse files Browse the repository at this point in the history
Fixes: AFORM-3843
  • Loading branch information
hungoptimizely committed Dec 28, 2023
1 parent db491d8 commit 5047fdd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/@episerver/forms-sdk/src/form-validator/formValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class FormValidator {
* @returns True or false
*/
validateRequired(value: any): boolean{
if (isNullOrEmpty(value)
if (isNull(value)
//for text, textarea
|| (typeof value === "string" && isNullOrEmpty(value.trim()))
// for FileUpload element
|| (value instanceof Array && value.length === 0)) {
return false;
Expand Down

0 comments on commit 5047fdd

Please sign in to comment.