This repository was archived by the owner on Apr 6, 2021. It is now read-only.
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
esapi js validation not working #12
Open
Description
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<!-- esapi4js dependencies -->
<script type="text/javascript" language="JavaScript" src="http://localhost/esapi/esapi4js/lib/log4js.js"></script>
<!-- esapi4js core -->
<script type="text/javascript" language="JavaScript" src="http://localhost/esapi/esapi4js/esapi.js"></script>
<!-- esapi4js i18n resources -->
<script type="text/javascript" language="JavaScript" src="http://localhost/esapi/esapi4js/resources/i18n/ESAPI_Standard_en_US.properties.js"></script>
<!-- esapi4js configuration -->
<script type="text/javascript" language="JavaScript" src="http://localhost/esapi/esapi4js/resources/Base.esapi.properties.js"></script>
<script type="text/javascript" language="JavaScript">
Base.esapi.properties.logging['ApplicationLogger'] = {
Level: org.owasp.esapi.Logger.ALL,
Appenders: [ new Log4js.ConsoleAppender() ],
LogUrl: true,
LogApplicationName: true,
EncodingRequired: true
};
Base.esapi.properties.application.Name = "My Application v1.0";
org.owasp.esapi.ESAPI.initialize();
$ESAPI.logger('ApplicationLogger').info(org.owasp.esapi.Logger.EventType.
EVENT_SUCCESS, 'This is a test message');
document.writeln( $ESAPI.encoder().encodeForHTML("<a href=\"http://owaspesapi-js.googlecode.com\">Check out esapi4js</a>"));
var validateCreditCard = function() {
alert($ESAPI.validator().isValidCreditCard($('CreditCard').value));
//allow.html5.validation: true;
//return $ESAPI.validator().isValidCreditCard( $('CreditCard').value);
}
</script>
</head>
<body>
<form name="user-profile-form" method="post" id="user-profile-form" action=""
onsubmit="return validateCreditCard();" >
<span>credit Card: </span><input name="CreditCard" type="text"
class="inputarea" id="CreditCard" maxlength="100"/>
<input type="submit" name="submit" id="submit" value="submit"/>
</form>
</body>
</html>
This code not working. Pls post your how to change the working code.
Original issue reported on code.google.com by [email protected]
on 24 Aug 2012 at 4:43