Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi Steve,
Did you ever work this out? I have a similar requirement, but I'm not using form guides. I need a submit button that doesn't check the validations so that I can save the incomplete form. I'll have a second submit button that does check the validations. I have thought of two approaches, but I'm hoping there's a better idea:
1) In my "draft" submit button, put a script that loops through the form objects and sets the mandatory objects to non-mandatory. I would use the technique of a normal button that runs a script and programatically clicks the real, invisible submit button. Similarly, I would have to mandatorize all the fields again programatically using my "final" submit button.
2) Don't use mandatory fields at all. Just do my null checking using script. I don't like this one because I lose the nice red borders that don't print.
Thoughts? It sure would be nice to have a submit button with an option of not checking the validations.
Jared Langdon
Views
Replies
Total Likes
Okay here's a nice little function I wrote to turn off all the mandatory fields in your form.
function unMandatoryAll() {
//makes all mandatory fields not mandatory anymore
var oFormRoot = xfa.form.nodes.item(0);
var arrMandatoryFieldNames = findMandatories(oFormRoot, new Array());
for (var i=0; i<arrMandatoryFieldNames.length; i++) {
var oCurrentField = xfa.resolveNode(arrMandatoryFieldNames[i]);
oCurrentField.validate.nullTest = "disabled";
}
}
function findMandatories(oFormNode, arrMandatoryFieldNames) {
//loops recursively through all fields in the given oFormNode and builds up a list of field names (actually SOM expressions)
var oChildNodes = oFormNode.nodes;
var nNumberOfChildNodes = oChildNodes.length;
for (var i=0; i<nNumberOfChildNodes; i++) {
var oCurrentNode = oChildNodes.item(i);
var strNodeType = oCurrentNode.className;
if (strNodeType == "subform")
arrMandatoryFieldNames = findMandatories(oCurrentNode, arrMandatoryFieldNames);
if ((strNodeType == "field") || (strNodeType == "exclGroup")) {
if (oCurrentNode.validate.nullTest == "error")
arrMandatoryFieldNames.push(oCurrentNode.somExpression);
}
}
return arrMandatoryFieldNames;
}
Jared Langdon
Views
Replies
Total Likes