I have to read custom attributes of some elements of a web-page form. How to get in the server handler these attributes?
To try to do it I have modified the web page of the ServerExample login web page in this way:
As you can see I added a data-xxx attribute. How can I get this attribute in the Handle sub of the server?
Thanks in advance
Roberto
To try to do it I have modified the web page of the ServerExample login web page in this way:
Login example from ServerExample modified:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="windows-1252" />
<title>B4J - System login example</title>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
</head>
<body>
<form id="registerForm">
<h1>Register as a new user or <a href="signin.html">sign in</a></h1>
<div> <label for="name">Name:</label> <input name="username" data-tipo="tipo1"
type="text" /> </div>
<div> <label for="password">Password:</label> <input name="password" id="password"
type="password" /> </div>
<div> <label for="verify">Verify password:</label> <input id="verify" type="password" />
</div>
<br />
<script type="text/javascript" src="https://www.google.com/recaptcha/api/challenge?k=6LcDKfASAAAAAP4JUE_Lq8D5zUswcviBtocXdvGs"> <!-- change to your public key -->
</script> <noscript>
<iframe id="captcha" src="https://www.google.com/recaptcha/api/noscript?k=6LcDKfASAAAAAP4JUE_Lq8D5zUswcviBtocXdvGs"
<!--="" change="" to="" your="" public="" key="" --="">
height="300" width="500" frameborder="0"></iframe><br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40"> </textarea>
<input name="recaptcha_response_field" value="manual_challenge" type="hidden" />
</noscript> <br />
<div id="btnRegister"> <button type="submit">Register</button> </div>
</form>
<script>
$( document ).ready(function() {
$("#btnRegister").click(function(e) {
e.preventDefault();
if ($("#verify").val() != $("#password").val()) {
alert("Password do not match!");
return;
}
$.ajax({
type: "POST",
url: "registerHelper",
data: $("#registerForm").serialize(),
success: function(result)
{
if (result.success) {
window.location = 'members/index.html';
}
else {
alert(result.errorMessage);
Recaptcha.reload();
}
},
error: function (xhr, ajaxOptions, thrownError) {
alert(thrownError);
Recaptcha.reload();
}
});
});
});
</script>
</body>
</html>
Thanks in advance
Roberto