The validation for email alerts me but when I click Ok it saves the record to salesforce
Here is the code:
<apex:page controller="myAudit">
<script type="text/javascript">
function validate() {
var ex= document.getElementsByClassName('email')[0].value;
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
var a = re.test(email);
alert("re.text_" + a);
if (a == true)
{ alert('Valid email address'); }
else { alert('Invalid email address'); }
}
</script>
<apex:form id="audit">
<apex:pageblock >
<apex:pageblockSection columns="1">
<p><apex:inputText value="{!account}" label="Account"/></p>
<apex:inputText id="Survey" value="{!txtSurvey}" label="SurveyName"/>
<apex:inputText id="email" value="{!email}" Label="Email" styleClass="examNote"/>
<apex:commandButton action="{!save}" onclick="validate();" value="save"/>
</apex:pageblockSection>
</apex:pageblock>
</apex:form>
</apex:page>