- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Yet another one that should be straightforward but is giving me a headache!
I've set a validateForm.checkForm function on a button (not a submit button) where I'm sending in the form -
if
(validateForm.checkForm(xfa.form))Within the checkForm function I'm doing the following initial steps:
function
{
var myForm = completedForm.nameOfTopForm.nameOfSubformThatHoldsEverything;
checkForm(completedForm)var firstSubformName = myForm.nameOfFirstSubform;
If the firstSubformName is visible, I then check the value of the field inside it:
var
if (ddlUnderFirstSubform.rawValue == 1) // not selected
{
// do stuff
}
Originally I was simply highlighting each required field in turn by doing:
highlightErrors(ddlUnderFirstSubform);
xfa.host.setFocus(ddlUnderFirstSubform);
This worked fine.
But then I wanted to keep a list of all the errors & highlight/setFocus to all at the same time, so:
var reqFieldsList = new String(); // set as global var
if (reqFieldsList == ""){reqFieldsList = reqFieldsList + ddlUnderFirstSubform;}
else{reqFieldsList = reqFieldsList + ',' + ddlUnderFirstSubform;}When I've been through the whole form & try the following it doesn't work:
if
{
(reqFieldsList != "") var reqFields = reqFieldsList.split(','); var firstField = reqFields[0]; highlightErrors(firstField);xfa.host.messageBox('A message', 'Title for box', 0, 0); ddlUnderFirstSubform = firstSubformName.nameOfDropdown;xfa.host.setFocus(firstField);
}
app.alert on the firstField in both the original method & new list method shows that ddlUnderFirstSubform is [object XFAObject], but one method wors the other doesn't - any ideas?
Apologies for the long-winded message - by the way, I'm not using the in-built LiveCycle required unctionality but merely going through all fields that I know are mandatory.
Thanks,
Views
Replies
Total Likes