Expand my Community achievements bar.

Submit and Print Button

Avatar

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

Avatar

Former Community Member
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");

Avatar

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?

Avatar

Former Community Member
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.

Avatar

Level 2
Thanks, Paul. I managed with a validation dcript on the print button.

Avatar

Former Community Member
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?

Avatar

Former Community Member
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");

}