Expand my Community achievements bar.

Save button doesn't save with event validation

Avatar

Level 4

In testing a form, I find that a regular button for saving the form locally doesn't work when I add validation to an event. The button will work at first, if I don't fill in any fields and click the Save button. And it will trigger the error message if I fill out the first five fields. But if I fill out the City field, the button stops sending the error. On the other hand, I also have a Send by Email button, which seems to work no matter how many fields are empty or filled in.

Thank you for any suggestions that might solve this dilemma.

form1.#subform[8].saveFormBtn::mouseUp - (JavaScript, client)
if (FirstNameTxt.rawValue == null ||
    LastNameTxt.rawValue == null ||
    JobTitleTxt.rawValue == null ||
    StoreNumTxt.rawValue == null ||
    StreetTxt.rawValue == null ||
    CityTxt.rawValue == null ||
    USSStatesDdl.rawValue == null ||
    zipCodeTxt.rawValue == null ||
    ReasonDdl.rawValue == null ||
    AssociateSignatureTxt.rawValue == null ||
    workedMonthsDdl.rawValue == null ||
    workedHoursDdl.rawValue == null ||
    are50Ddl.rawValue == null ||
    approvalDdl.rawValue == null ||
    MgrSignatureTxt.rawValue == null ||
    distRegionTxt.rawValue == null)
    {
    xfa.host.messageBox("Please fill out the required fields first.");
    }
else
   {
       app.execMenuItem("SaveAs");
   }

3 Replies

Avatar

Level 4

The problem seems to come up around StoreNumTxt or FileNumTxt. The Save button continues to work until I put a number in one of those fields. If I delete the value, the button will work again and show the error message. What could possibly account for this behavior?

form1.#subform[8].saveFormBtn::mouseUp - (JavaScript, client)

if (FirstNameTxt.rawValue == null ||

    LastNameTxt.rawValue == null ||

    JobTitleTxt.rawValue == null ||

    StoreNumTxt.rawValue == null ||

    FileNumTxt.rawValue == null ||

    HireDateDate.rawValue == null ||  

    StreetTxt.rawValue == null ||

    CityTxt.rawValue == null ||

    USSStatesDdl.rawValue == null ||

    zipCodeTxt.rawValue == null ||

    ReasonDdl.rawValue == null ||

    AssociateSignatureTxt.rawValue == null ||

    dateSignedAssocDate.rawValue == null ||

    workedMonthsDdl.rawValue == null ||

    workedHoursDdl.rawValue == null ||

    are50Ddl.rawValue == null ||

    approvalDdl.rawValue == null ||

    MgrSignatureTxt.rawValue == null ||

    distRegionTxt.rawValue == null ||

    dateSignedDate.rawValue == null)

    {

    xfa.host.messageBox("Please fill out the required fields first.");

    }

else

   {

       app.execMenuItem("SaveAs");

   }

Avatar

Level 10

Probably if you can send the form that helps. Send it to LiveCycle9@gmail.com

Thanks

Srini

Avatar

Level 4

Thank you for you, Srini, for your help. I sent you two versions of the same form. Basically, I'd like to keep the functionality of the Submit by Email button and give the user the opportunity to save the file after validation and then emailing the form.