Highlighted

Submit and Print Button

_Win_Lam_

25-11-2008

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.

Replies

Highlighted

pguerett

25-11-2008

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

_Win_Lam_

25-11-2008

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?
Highlighted

pguerett

26-11-2008

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.
Highlighted

Avatar

Guest

19-12-2008

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?
Highlighted

pguerett

19-12-2008

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

}