Example -
Validation: Filename cannot contain special characters (for example, / \ ; : " | ? ' < > * ).
Expression evaluation error: Syntax error. Details: Expression evaluation error : Invalid character found in expression: |
Discussion posts and replies are publicly visible
Hi. Refer the code below:
if( a!isNullOrEmpty(ri!input), null, regexreplaceall( pattern: "[\\/;:""|?'<>*\]\[]", searchString: trim(ri!input), replacementString: "" ) )
that did not work - need to show the validation message on the screen for fileupload component
a!fileUploadField( label: "Upload File", target: cons!FOLDER_CONSTANT, value: ri!uploadedFile, saveInto: ri!uploadedFile,
validations: if( and( not(isnull(ri!uploadedFile)), length(stripwith(ri!uploadedFile.name, "\ / ; : "" | ? ' < > *")) <> length(ri!uploadedFile.name) ),"Filename cannot contain special characters (for example, / \ ; : " | ? ' < > * )." null))
Try this:
a!localVariables( local!file, { a!fileUploadField( label: "Upload File", target: cons!FOLDER_CONSTANT, value: local!file, saveInto: local!file, validations: { if( a!isNullOrEmpty(fv!files), null, if( regexmatch( pattern: "[\\/;:""|?'<>*\]\[]", searchString: trim(fv!files.name), ), "Filename cannot contain special characters (for example, / \ ; : "" | ? ' < > * ).", null ) ) }, maxSelections: 1 ) } )