@@ -117,11 +117,12 @@ <h2>Contact Now</h2>
117117 < div class ="contactForm ">
118118 <!-- <form action="#" method="post"> -->
119119
120- < form
120+ <!-- < form
121121 action="https://formcarry.com/s/S2thQbCqEvW"
122122 method="POST"
123123 accept-charset="UTF-8"
124- >
124+ > -->
125+ < form onsubmit =" event.preventDefault(); JSalert(); ">
125126 < p >
126127 < label for ="fname "> First Name</ label >
127128 < input
@@ -145,7 +146,6 @@ <h2>Contact Now</h2>
145146 < p >
146147 < label for ="email "> Your Email</ label >
147148 < input
148- type ="email "
149149 id ="email "
150150 placeholder ="Enter your Email id here "
151151 name ="email "
@@ -181,12 +181,7 @@ <h2>Contact Now</h2>
181181 >
182182 Back
183183 </ button >
184- < input
185- onclick ="JSalert() "
186- type ="submit "
187- id ="submit "
188- value ="Send Message "
189- />
184+ < input type ="submit " id ="submit " value ="Send Message " />
190185 </ p >
191186 </ form >
192187 </ div >
@@ -210,8 +205,24 @@ <h2>Contact Now</h2>
210205 <!-- Closed Footer -->
211206 < script src ="./assets/js/scripts.js "> </ script >
212207 < script type ="text/javascript ">
208+ function ValidateEmail ( inputText ) {
209+ var mailformat =
210+ / ^ [ a - z A - Z 0 - 9 . ! # $ % & ' * + / = ? ^ _ ` { | } ~ - ] + @ [ a - z A - Z 0 - 9 - ] + (?: \. [ a - z A - Z 0 - 9 - ] + ) * $ / ;
211+ if ( inputText . match ( mailformat ) ) return true ;
212+ else return false ;
213+ }
214+
213215 function JSalert ( ) {
214- swal ( "Congrats!" , "Message was delivered successfully!" , "success" ) ;
216+ console . log ( document . getElementById ( "email" ) . value ) ;
217+ if ( ValidateEmail ( document . getElementById ( "email" ) . value ) ) {
218+ swal ( "Congrats!" , "Message was delivered successfully!" , "success" ) ;
219+ console . log ( "Its true" ) ;
220+ return true ;
221+ } else {
222+ swal ( "Error!" , "Email is not entered correctly!" , "error" ) ;
223+ console . log ( "Its false" ) ;
224+ return false ;
225+ }
215226 }
216227 </ script >
217228 < script src ="https://unpkg.com/sweetalert/dist/sweetalert.min.js "> </ script >
0 commit comments