This product is retired as of September 2020 See PDFTon WebView
===
Some code snippet examples for Set/Get field information
// Set field info on load
readerplus.Document.addEventListener("load", function () {
var page = readerplus.Document.getPage(1);
var fields = page.getAllFields();
for (var i = 0; i < fields.length; i++) {
// Last name
if (fields[i].name === 'LastName') {
var field = readerplus.Document.getField(fields[i].id);
field.setFieldProperties({ value: "Doe", color: '#FF0000', require: true });
}
//Address
if (fields[i].name == 'Add1') {
var field = readerplus.Document.getField(fields[i].id);
//fields[i].require = true;
field.setFieldProperties({ require: true });
}
// Radio button
if (fields[i].name === 'BOX1') {
var field = readerplus.Document.getField(fields[i].id);
field.setFieldProperties({ require: true });
}
}
});
// Get field info on submit
readerplus.Document.addEventListener("submit", function (strResult) {
var page = readerplus.Document.getPage(1);
var fields = page.getAllFields();
for (var i = 0; i < fields.length; i++) {
var fieldName = fields[i].name
var fieldValue = fields[i].value
var fieldType = fields[i].type
var fieldID = fields[i].id
//do something with info
alert("Field Name: " + fieldName + " Field Value: " + fieldValue + " FieldType= "+fieldType+" FieldID="+fieldID)
if (fields[i].require === true) {
var fieldRequire = fields[i].require
alert("Field Name: " +fieldname + "Required value is: " + fieldRequire)
}
}
});
Comments
0 comments
Please sign in to leave a comment.