function ValidateData() { //debugger; var StartCreateDate = $('#FromCreatedDate').val(); var EndCreateDate = $('#ToCreatedDate').val(); var StartMigrationDate = $('#FromMigrationDate').val(); var EndMigrationDate = $('#ToMigrationDate').val(); var SendToEmail = $('#SendEmailTo').val(); if ((StartCreateDate != null && EndCreateDate != null) && (StartCreateDate > EndCreateDate)) { alert("From create date must be greater than to create date") return false; } if ((StartMigrationDate != null && EndMigrationDate != null) && (StartMigrationDate > EndMigrationDate)) { alert("From migration date must be greater than to migration date") return false; } if (SendToEmail "doesn't have the correct format") //Here I want to validate my email address $('#SendEmailTo').val(); { alert("Email format is incorrect") return false; } return true; }
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: "[" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 110:
Line 111: function emailHaveCorrectFormat(email) {
Line 112: var filter = ^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$;
Line 113: return filter.test(email.value);
Line 114: }
lulu50
ASKER
the same error I try the other one
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: "[" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 124: var EndMigrationDate = $('#ToMigrationDate').val();
Line 125: var SendToEmail = $('#SendEmailTo').val();
Line 126: var ValidEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
Line 127:
Line 128:
Bill Prew
Not sure your environment, but in a couple of bare bones tests here the part I suggested seems to work...
function emailHaveCorrectFormat(email) { var filter = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; return filter.test(email.value);}
I still get the same error
it's looking for this ( )
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: "[" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 110:
Line 111:function emailHaveCorrectFormat(email) {
Line 112: var filter = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
Line 113: return filter.test(email.value);
Line 114:}
I'm getting this error
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: "[" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid.
Source Error:
Line 110:
Line 111: function emailHaveCorrectFormat(ema
Line 112: var filter = ^[a-zA-Z0-9.!#$%&'*+\/=?^_
Line 113: return filter.test(email.value);
Line 114: }