<async-editable-field>
<async-editable-field>
is an editable field component which can validate input and POST asynchronously
<async-editable-field
id="myField"
name="fieldName"
value="Field Value"
url="http://localhost:8085/endpoint/"
save-text="Update"
cancel-text="Cancel">
</async-editable-field>
<script>
var editableField = document.querySelector('async-editable-field#myField');
editableField._setSuccessResponseFunction(function(response) {
alert("Success: " + response);
});
editableField._setErrorResponseFunction(function(response, status) {
alert("[" + status + "] Response: " + response);
});
editableField._setValidationFunction(function(value) {
var reg = new RegExp(/^\d+$/);
if (!reg.test(value)) {
alert("Value must only contain numbers!");
return false;
}
return true;
});
</script>