-
1. Re: Currently cannot figure out how to add radio buttons to this javascript so it works on them aswell.
jensenc221479 Sep 20, 2016 8:57 AM (in response to jensenc221479)I am still struggling with this any help would be greatly appreciated
-
2. Re: Currently cannot figure out how to add radio buttons to this javascript so it works on them aswell.
jensenc221479 Sep 20, 2016 12:59 PM (in response to jensenc221479)I tried f.type=="radio" && f.value=="Off" as another or statement but this doesnt work
-
3. Re: Currently cannot figure out how to add radio buttons to this javascript so it works on them aswell.
George_Johnson Sep 20, 2016 1:23 PM (in response to jensenc221479)Try the following. I removed some extraneous stuff and formatted it for readability.
var emptyFields = [];
for (var i = 0; i < numFields; i++) {
var f = getField(getNthFieldName(i));
if (f.type != "button" && f.required ) {
f.strokeColor = color.black;
if (
(f.type == "text" && f.valueAsString == "")
|| (f.type == "checkbox" && f.valueAsString == "Off")
|| (f.type == "radiobutton" && f.valueAsString == "Off")
|| (f.type == "combobox" && f.valueAsString == " ")) {
emptyFields.push(f.name);
f.strokeColor = color.red;
}
}
}
if (emptyFields.length > 0) {
app.alert("Error! You must fill in all required fields (Highlighted in red)");
}
-
4. Re: Currently cannot figure out how to add radio buttons to this javascript so it works on them aswell.
jensenc221479 Sep 20, 2016 1:36 PM (in response to jensenc221479)Thanks a ton i knew all i was doing was using the wrong naming conventions. although yours is much prettier and probably much more effecient. Worked like a charm!