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

Avatar

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile
peartreeco
Level 2

15-01-2011

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")

else

Print_Form.execEvent("click")

endif

Brenda

Replies

Avatar

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile
peartreeco
Level 2

15-01-2011

Ok, well my reference to the fields were incorrect.  Here is the new code:


if (Page7.NameofReferralSource.rawValue == null){

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

}else{

Print_Form.execEvent("click");

}
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

The first part that checks for an empty field and displays a message works however the print dialog still pops up after the user clicks ok to the error message.  Any ideas?

Avatar

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile

Avatar
Give Back
Level 2
peartreeco
Level 2

Likes

5 likes

Total Posts

17 posts

Correct reply

1 solution
Top badges earned
Give Back
Ignite 1
Validate 1
Boost 5
Boost 3
View profile
peartreeco
Level 2

15-01-2011

OKKKK, answered my own question.  I created a hidden button and added the print command to the click event and removed the print command from

the dummy print button.  Everything works great!


Avatar

Avatar
Level 1
designer525
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
designer525
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
designer525
Level 1

04-10-2011

What do you mean you created a hidden button?  Also were u able to do this to more than one field?