diff --git a/app/client/public/index.html b/app/client/public/index.html
index 373ce7f074..5c9057683b 100755
--- a/app/client/public/index.html
+++ b/app/client/public/index.html
@@ -16,6 +16,23 @@
transition: all ease-in 0.3s;
}
+
+
+
@@ -84,13 +101,6 @@
intercomAppID: parseConfig("__APPSMITH_INTERCOM_APP_ID__"),
};
-
diff --git a/app/client/src/widgets/InputWidget.tsx b/app/client/src/widgets/InputWidget.tsx
index 889df93c60..d2c17d7ee2 100644
--- a/app/client/src/widgets/InputWidget.tsx
+++ b/app/client/src/widgets/InputWidget.tsx
@@ -58,7 +58,29 @@ class InputWidget extends BaseWidget {
static getDerivedPropertiesMap(): DerivedPropertiesMap {
return {
- isValid: `{{!!(this.isRequired ? this.text && this.text.length > 0 ? this.regex ? new RegExp(this.regex).test(this.text) : true : false : this.regex ? new RegExp(this.regex).test(this.text) : true)}}`,
+ isValid: `{{
+ function(){
+ const isEmailType = this.inputType === "EMAIL";
+ if(isEmailType) {
+ const emailRegex = new RegExp(/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/);
+ return emailRegex.test(this.text);
+ } else if(this.isRequired) {
+ if(this.text && this.text.length > 0) {
+ if(this.regex) {
+ return new RegExp(this.regex).test(this.text)
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ } if(this.regex) {
+ return new RegExp(this.regex).test(this.text)
+ } else {
+ return true;
+ }
+ }()
+ }}`,
value: `{{this.text}}`,
};
}
@@ -117,6 +139,7 @@ class InputWidget extends BaseWidget {
const value = this.state.text || "";
const isInvalid =
"isValid" in this.props && !this.props.isValid && !!this.props.isDirty;
+
const conditionalProps: Partial = {};
conditionalProps.errorMessage = this.props.errorMessage;
if (this.props.isRequired && value.length === 0) {