Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
just learning here:
What does the "DR" and "FR" represent in this code? Are they field names?
else
{
var T = this.getField("DR");
var F = this.getField("FD");
T.readonly = true;
F.readonly = true;
}
Copy link to clipboard
Copied
This are field names.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hello Everyone,
I like this script and was hoping I could get some help. I would just like to incorporate multiple required fields. I'm no export programmer (I'm sure its obvious by looking by example). Any suggestions!?
var S = this.getField("test1").value;
var Q = this.getField("test2").value;
if (S =="") and (Q =="")
{
app.alert("You must fill in all required fields before submitting.");
T.readonly = false;
F.readonly = false;
}
else
{
var T = this.getField("DR");
var F = this.getField("FD");
T.readonly = true;
F.readonly = true;
}
Thank you,
CJ
Copy link to clipboard
Copied
Problem 1:
Change this line:
if (S =="") and (Q =="")
To this:
if ((S =="") && (Q ==""))
Problem 2:
You are trying to access T and F in the first block without declaring them.
I suggest you declare them at the beginning of the script, after S and Q.
Copy link to clipboard
Copied
(also, you should open a new thread, not hijack this one)
Copy link to clipboard
Copied
Wow, thank you for your quick reply. I'll give you what you suggested a shot.
Also thanks for the tip on forum etiquette (still new)...sorry.
Thank you,
CJ
Copy link to clipboard
Copied
anybody know if is there any way of getting an arrayList with the whole Fields in the form? It would be great if I we could going through the structure in the same way we can do it in Javascript and HTML with "getElementsByTagName" instead of creating an array of Strings with all the fields' names and doing this.getField("...") for each one
Thanks a lotCopy link to clipboard
Copied
Look at the method getNthFieldName in conjunction with the numFields
property of the Document object.
Copy link to clipboard
Copied
ok thank you a lot, it seems works fine 😉
This is my code:
//this part is for validate all the fields in document by sections
//Validation methods throws alerts in case of error and focus the cursor on the wrong field
var okres=validarSolicitante();
if (okres=="ok"){
okres="";
okres=validarOtrosDatos();
}
if (okres=="ok"){
okres="";
okres=validarFirma();
}
//After validation, if is all is correct we show a confirm message and proceed to submit the form
if (okres=="ok"){
var nButton = app.alert({cMsg: "¿Está seguro de que desea enviar los datos del formulario?",
cTitle: "Confirmación de envío", nIcon: 2, nType: 2});
if ( nButton == 4 ) {
var campos = new Array();
var f;
var pos = 0;
//app.alert("nCampos del formulario:" + this.numFields);
//we collect all the fields into an array
for ( var i=0; i < this.numFields; i++) {
var fname = this.getNthFieldName(i);
f = this.getField(fname);
if ( f.type != "button" ){
campos[pos] = fname;
pos++;
}
}
/*we can show with alerts that all is ok
app.alert("Array de campos:" + campos.length);
for ( var i=0; i < campos.length ; i++) {
f = this.getField(campos);
app.alert("(" + i + ") " + campos + " = " + f.value);
}
*/
//and submit the form
this.submitForm({cURL: "https://www...", bEmpty: true, aFields: campos, cSubmitAs: "FDF"});
}
}