These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Validating & block before submit

lamarse
Registered: Oct 21 2008
Posts: 15
Answered

Hi there,

Into a button, in the preSubmit as Javascript I would need to check all the fields if are empty (so those that the validating is setup) and in case everything is okay, then to BLOCK all the fields.
Well, the code it works separately (first part check for validations, second simple block fields) but what it does seems to not work is to make it work together: if everything is okay then block fields, if not simple tell it to me and let me fix it.

Please, can anyone help me in fixing this code?

//1st part
form1.execValidate();

//this is the part of code that is wrong, I know..
var nRtn = app.alert(cMsg,1,2, "Lock Form?");
if(nRtn == 4)
{

//2nd part
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
// Set the field property.
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
oFields.item(nNodeCount).access = "protected";
}
}

}
endif;

What I really need is to check for validations (1st part). If everything is okay, then go to the 2nd part. In case is not, then to show a windows to tell me and when I click ok to let me fill the missing (empty) fields, then when I click submit button again, to recheck (1st part) and as okay, to go strait to 2nd part.

Hope it is clear.

Thank you in advance

MyVi

lamarse
Registered: Oct 21 2008
Posts: 15
Okay,
I've got myself a solution already.

Well, look into this zip file 'cause in there I've got the solution to my problem.

http://download.macromedia.com/pub/developer/validating_field_content.zip

Thank you to any of you who have even read my post.