3 Replies Latest reply on Oct 4, 2011 12:01 PM by designer525

    Empty field Validation before Print, What's Wrong with THIS code??


      I have been trying unsuccessfully to get this code to work.. I am stumped!  I created a print button.  Then added this script under "Form Calc" in the Click event of the button.  But when clicked nothing happens.  I have a radio button group that has different options but I only want to make the field NameofReferralSource required if the user checks Broker.  The print button is on page 1.  The field and radio button group are on page 7.  I just can't figure out how to get this to work.  I don't necessarily need to make the fields required since then I would have to add script remove the red border and add a message telling user where the field is otherwise they will have to search through 6 pages to find it. (maybe a better solution?)  I just want a simple code that fires when the user hits the Print, Save, or Submit button to check if Broker name is empty and if it is, prompt them to fill in.  Help!


      if ((topmostSubform.Page7.NameofReferralSource.rawValue == null)  & (topmostSubform.Page7.Howdidyouhear.0.rawValue == "Broker")) then


      xfa.host.messageBox("You must enter the the Name of the Broker under Referral Name on Page 7 to be able to print this form")