Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Submit and Print Button

_Win_Lam_
Level 2
Level 2
Hi,



May i know how do i post a "Print" script into an existing submit button sharing the same principles to validate mandatory fields?



So once a User clicks on the submit and print button, fields will be validated, printing will be triggered without having to display the print window and the email functioning as per normal?



please help. Thanks.
6 Replies
pguerett
Level 10
Level 10
You will need to hide the submit and print buttons.



Then create a new regulat button. On the click evnt of the new button you would cause the other two buttons to be pushed. Something like this:



SubmitButtonName.execEvent("click");

PrintButtonName.execEvent("click");
_Win_Lam_
Level 2
Level 2
Hi Paul, thanks for the advice.



The submit button will validate and prompt users that there are mandatory fields not filled in, will the print button works the same too?



Can i also print straightaway without having to show the print window?
pguerett
Level 10
Level 10
By doing the submit 1st the validations will run before the print. I believe that if you pass all of the needed options in teh print command that you can print without that dialog but I am not 100% sure.
_Win_Lam_
Level 2
Level 2
Thanks, Paul. I managed with a validation dcript on the print button.
Not applicable
Pardon me for being the least familiar with this product, but I am in need of this same button action (submit only to validate required fields, and the trigger the print).

Paul - would you kindly give me more remedial instruction as to how to program the regular button to complete both tasks?
pguerett
Level 10
Level 10
The technique woudl be to have a print button and a submit button on the form doing their normal functions - then hiding thise buttons (making them hidden). Then adding a 3rd normal button (this will allow you to program on the click event) then writing code that will do something like this:



//Run validations

if (form1.execValidate()){

execute print command

execute submit command

} else {

app.alert("Validations failed");

}